mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-11 08:04:09 -08:00
Merge branch 'develop'
This commit is contained in:
commit
6ce01487c5
|
@ -125,6 +125,10 @@ class AssetsController extends Controller
|
|||
$assets->ByManufacturer($request->input('manufacturer_id'));
|
||||
}
|
||||
|
||||
if ($request->has('depreciation_id')) {
|
||||
$assets->ByDepreciationId($request->input('depreciation_id'));
|
||||
}
|
||||
|
||||
$request->has('order_number') ? $assets = $assets->where('assets.order_number', '=', e($request->get('order_number'))) : '';
|
||||
|
||||
$offset = request('offset', 0);
|
||||
|
@ -133,28 +137,61 @@ class AssetsController extends Controller
|
|||
|
||||
|
||||
// This is used by the sidenav, mostly
|
||||
|
||||
// We switched from using query scopes here because of a Laravel bug
|
||||
// related to fulltext searches on complex queries.
|
||||
// I am sad. :(
|
||||
switch ($request->input('status')) {
|
||||
case 'Deleted':
|
||||
$assets->withTrashed()->Deleted();
|
||||
break;
|
||||
case 'Pending':
|
||||
$assets->Pending();
|
||||
$assets->join('status_labels',function ($join) {
|
||||
$join->on('status_labels.id', "=", "assets.status_id")
|
||||
->where('status_labels.deployable','=',0)
|
||||
->where('status_labels.pending','=',1)
|
||||
->where('status_labels.archived', '=', 0);
|
||||
});
|
||||
break;
|
||||
case 'RTD':
|
||||
$assets->RTD();
|
||||
$assets->join('status_labels',function ($join) {
|
||||
$join->on('status_labels.id', "=", "assets.status_id")
|
||||
->where('status_labels.deployable','=',1)
|
||||
->where('status_labels.pending','=',0)
|
||||
->where('status_labels.archived', '=', 0);
|
||||
});
|
||||
break;
|
||||
case 'Undeployable':
|
||||
$assets->Undeployable();
|
||||
break;
|
||||
case 'Archived':
|
||||
$assets->Archived();
|
||||
$assets->join('status_labels',function ($join) {
|
||||
$join->on('status_labels.id', "=", "assets.status_id")
|
||||
->where('status_labels.deployable','=',0)
|
||||
->where('status_labels.pending','=',0)
|
||||
->where('status_labels.archived', '=', 1);
|
||||
});
|
||||
break;
|
||||
case 'Requestable':
|
||||
$assets->RequestableAssets();
|
||||
$assets->where('assets.requestable', '=', 1)
|
||||
->join('status_labels',function ($join) {
|
||||
$join->on('status_labels.id', "=", "assets.status_id")
|
||||
->where('status_labels.deployable','=',1)
|
||||
->where('status_labels.pending','=',0)
|
||||
->where('status_labels.archived', '=', 0);
|
||||
});
|
||||
|
||||
break;
|
||||
case 'Deployed':
|
||||
$assets->Deployed();
|
||||
// more sad, horrible workarounds for laravel bugs when doing full text searches
|
||||
$assets->where('assets.assigned_to', '>', '0');
|
||||
break;
|
||||
default:
|
||||
// terrible workaround for complex-query Laravel bug in fulltext
|
||||
$assets->join('status_labels',function ($join) {
|
||||
$join->on('status_labels.id', "=", "assets.status_id")
|
||||
->where('status_labels.archived', '=', 0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -481,6 +518,9 @@ class AssetsController extends Controller
|
|||
$data['item_tag'] = $asset->asset_tag;
|
||||
$data['item_serial'] = $asset->serial;
|
||||
$data['note'] = $logaction->note;
|
||||
$data['manufacturer_name'] = $asset->model->manufacturer->name;
|
||||
$data['model_name'] = $asset->model->name;
|
||||
$data['model_number'] = $asset->model->model_number;
|
||||
|
||||
if ((($asset->checkin_email()=='1')) && (isset($user)) && (!config('app.lock_passwords'))) {
|
||||
Mail::send('emails.checkin-asset', $data, function ($m) use ($user) {
|
||||
|
|
|
@ -558,6 +558,9 @@ class AssetsController extends Controller
|
|||
$data['item_tag'] = $asset->asset_tag;
|
||||
$data['item_serial'] = $asset->serial;
|
||||
$data['note'] = $logaction->note;
|
||||
$data['manufacturer_name'] = $asset->model->manufacturer->name;
|
||||
$data['model_name'] = $asset->model->name;
|
||||
$data['model_number'] = $asset->model->model_number;
|
||||
|
||||
if ((($asset->checkin_email()=='1')) && (isset($user)) && (!empty($user->email)) && (!config('app.lock_passwords'))) {
|
||||
Mail::send('emails.checkin-asset', $data, function ($m) use ($user) {
|
||||
|
|
|
@ -155,5 +155,24 @@ class DepreciationsController extends Controller
|
|||
return redirect()->route('depreciations.index')->with('success', trans('admin/depreciations/message.delete.success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a view that displays a form to display depreciation listing
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net]
|
||||
* @see DepreciationsController::postEdit()
|
||||
* @param int $depreciationId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
if (is_null($depreciation = Depreciation::find($id))) {
|
||||
// Redirect to the blogs management page
|
||||
return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist'));
|
||||
}
|
||||
|
||||
return view('depreciations/view', compact('depreciation'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1106,4 +1106,20 @@ class Asset extends Depreciable
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Query builder scope to search on location ID
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $query Query builder instance
|
||||
* @param text $search Search term
|
||||
*
|
||||
* @return \Illuminate\Database\Query\Builder Modified query builder
|
||||
*/
|
||||
public function scopeByDepreciationId($query, $search)
|
||||
{
|
||||
return $query->join('models', 'assets.model_id', '=', 'models.id')
|
||||
->join('depreciations', 'models.depreciation_id', '=', 'depreciations.id')->where('models.depreciation_id', '=', $search);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -99,6 +99,9 @@ class CheckoutNotification extends Notification
|
|||
'item_serial' => $item->serial,
|
||||
'require_acceptance' => method_exists($item, 'requireAcceptance') ? $item->requireAcceptance() : '',
|
||||
'log_id' => $this->params['log_id'],
|
||||
'manufacturer_name' => $item->model->manufacturer->name,
|
||||
'model_name' => $item->model->name,
|
||||
'model_number' => $item->model->model_number,
|
||||
];
|
||||
|
||||
if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance() == '1'))
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
'all' => 'All',
|
||||
'archived' => 'Archived',
|
||||
'asset_models' => 'Asset Models',
|
||||
'asset_model' => 'Model',
|
||||
'asset' => 'Asset',
|
||||
'asset_report' => 'Asset Report',
|
||||
'asset_tag' => 'Asset Tag',
|
||||
|
|
54
resources/views/depreciations/view.blade.php
Normal file
54
resources/views/depreciations/view.blade.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
@extends('layouts/default')
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
|
||||
{{ trans('general.depreciation') }}
|
||||
: {{ $depreciation->name }}
|
||||
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ route('depreciations.edit', ['depreciation' => $depreciation->id]) }}" class="btn btn-sm btn-primary pull-right">{{ trans('admin/depreciations/table.update') }} </a>
|
||||
@stop
|
||||
|
||||
{{-- Page content --}}
|
||||
@section('content')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-default">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="table table-responsive">
|
||||
<table
|
||||
name="location_users"
|
||||
id="table-users"
|
||||
class="table table-striped snipe-table"
|
||||
data-url="{{ route('api.assets.index',['depreciation'=> $depreciation->id]) }}"
|
||||
data-cookie="true"
|
||||
data-click-to-select="true"
|
||||
data-cookie-id-table="department_usersDetailTable">
|
||||
<thead>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
@include ('partials.bootstrap-table', [
|
||||
'exportFile' => 'assets-export',
|
||||
'search' => true,
|
||||
'columns' => \App\Presenters\AssetPresenter::dataTableLayout()
|
||||
])
|
||||
|
||||
@stop
|
|
@ -57,5 +57,5 @@
|
|||
<p><strong><a href="{{ url('/') }}/account/accept-asset/{{ $log_id }}">{{ trans('mail.i_have_read') }}</a></strong></p>
|
||||
@endif
|
||||
|
||||
<p>{{ $snipeSettings->site_name }}</p>
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -25,6 +25,36 @@
|
|||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($manufacturer_name))
|
||||
<tr>
|
||||
<td>
|
||||
{{ trans('general.manufacturer') }}
|
||||
</td>
|
||||
<td>
|
||||
<strong>{{ $manufacturer_name }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($model_name))
|
||||
<tr>
|
||||
<td>
|
||||
{{ trans('general.model_no') }}:
|
||||
</td>
|
||||
<td>
|
||||
<strong>{{ $model_name }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($model_number))
|
||||
<tr>
|
||||
<td>
|
||||
{{ trans('general.asset_model') }}:
|
||||
</td>
|
||||
<td>
|
||||
<strong>{{ $model_number }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($item_serial))
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -87,5 +117,5 @@
|
|||
<p><strong><a href="{{ url('/') }}/account/accept-asset/{{ $log_id }}">{{ trans('mail.i_have_read') }}</a></strong></p>
|
||||
@endif
|
||||
|
||||
<p>{{ $snipeSettings->site_name }}</p>
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -9,4 +9,5 @@
|
|||
{{ trans('mail.canceled') }} {{ $requested_date }}
|
||||
</p>
|
||||
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -11,4 +11,5 @@
|
|||
{{ trans('mail.quantity') }} {{ $item_quantity}}
|
||||
@endif
|
||||
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -25,6 +25,36 @@
|
|||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($manufacturer_name))
|
||||
<tr>
|
||||
<td style="background-color:#ccc">
|
||||
{{ trans('general.manufacturer') }}
|
||||
</td>
|
||||
<td>
|
||||
<strong>{{ $manufacturer_name }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($model_name))
|
||||
<tr>
|
||||
<td style="background-color:#ccc">
|
||||
{{ trans('general.model_no') }}:
|
||||
</td>
|
||||
<td>
|
||||
<strong>{{ $model_name }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@if (isset($model_number))
|
||||
<tr>
|
||||
<td style="background-color:#ccc">
|
||||
{{ trans('general.asset_model') }}:
|
||||
</td>
|
||||
<td>
|
||||
<strong>{{ $model_number }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td style="background-color:#ccc">
|
||||
{{ trans('mail.checkin_date') }}
|
||||
|
@ -45,5 +75,5 @@
|
|||
@endif
|
||||
</table>
|
||||
|
||||
<p>{{ $snipeSettings->site_name }}</p>
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -17,5 +17,5 @@
|
|||
{!! $email_content !!}
|
||||
</table>
|
||||
|
||||
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -14,5 +14,5 @@
|
|||
{!! $email_content !!}
|
||||
</table>
|
||||
|
||||
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
|
||||
<p>{{ trans('mail.best_regards') }}</p>
|
||||
|
||||
<p>{{ $snipeSettings->site_name }}</p>
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -27,5 +27,6 @@
|
|||
|
||||
</table>
|
||||
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
|
||||
@stop
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
|
||||
<p>{{ trans('mail.best_regards') }}</p>
|
||||
|
||||
<p>{{ $snipeSettings->site_name }}</p>
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
|
||||
<p>{{ trans('mail.best_regards') }}</p>
|
||||
|
||||
<p>{{ $snipeSettings->site_name }}</p>
|
||||
<p><a href="{{ url('/') }}">{{ $snipeSettings->site_name }}</a></p>
|
||||
@stop
|
||||
|
|
|
@ -250,27 +250,25 @@ $('.snipe-table').bootstrapTable({
|
|||
if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && (!row.assigned_to)) {
|
||||
// case for licenses
|
||||
if (row.next_seat) {
|
||||
return '<a href="{{ url('/') }}/' + destination + '/' + row.next_seat + '/checkout" class="btn btn-sm btn-primary" data-tooltip="true" title="Check this item out to a user">{{ trans('general.checkout') }}</a>';
|
||||
return '<a href="{{ url('/') }}/' + destination + '/' + row.next_seat + '/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="Check this item out to a user">{{ trans('general.checkout') }}</a>';
|
||||
} else {
|
||||
return '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkout" class="btn btn-sm btn-primary" data-tooltip="true" title="Check this item out to a user">{{ trans('general.checkout') }}</a>';
|
||||
return '<a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkout" class="btn btn-sm bg-maroon" data-tooltip="true" title="Check this item out to a user">{{ trans('general.checkout') }}</a>';
|
||||
}
|
||||
|
||||
|
||||
// The user is allowed to check items out, but the item is not deployable
|
||||
} else if (((row.user_can_checkout == false)) && (row.available_actions.checkout == true) && (!row.assigned_to)) {
|
||||
return '<div data-tooltip="true" title="This item has a status label that is undeployable and cannot be checked out at this time."><a class="btn btn-sm btn-primary disabled">{{ trans('general.checkout') }}</a></div>';
|
||||
return '<div data-tooltip="true" title="This item has a status label that is undeployable and cannot be checked out at this time."><a class="btn btn-sm bg-maroon disabled">{{ trans('general.checkout') }}</a></div>';
|
||||
|
||||
// The user is allowed to check items in
|
||||
} else if (row.available_actions.checkin == true) {
|
||||
if (row.assigned_to) {
|
||||
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkin" class="btn btn-sm btn-primary" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
|
||||
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + row.id + '/checkin" class="btn btn-sm bg-purple" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
|
||||
} else if (row.assigned_pivot_id) {
|
||||
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + row.assigned_pivot_id + '/checkin" class="btn btn-sm btn-primary" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
|
||||
return '<nobr><a href="{{ url('/') }}/' + destination + '/' + row.assigned_pivot_id + '/checkin" class="btn btn-sm bg-purpley" data-tooltip="true" title="Check this item in so it is available for re-imaging, re-issue, etc.">{{ trans('general.checkin') }}</a>';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue