mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-11 08:04:09 -08:00
Merge branch 'develop'
# Conflicts: # config/version.php
This commit is contained in:
commit
79fe092c81
|
@ -637,7 +637,7 @@ class ReportsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('eol')) {
|
if ($request->has('eol')) {
|
||||||
$row[] = ($asset->eol) ? $asset->present()->eol_date() : '';
|
$row[] = ($asset->purchase_date!='') ? $asset->present()->eol_date() : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('order')) {
|
if ($request->has('order')) {
|
||||||
|
|
|
@ -1147,4 +1147,24 @@ class UsersController extends Controller
|
||||||
return response()->json(['message' => trans('admin/settings/general.two_factor_reset_error')], 500);
|
return response()->json(['message' => trans('admin/settings/general.two_factor_reset_error')], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LDAP form processing.
|
||||||
|
*
|
||||||
|
* @author Aladin Alaily
|
||||||
|
* @since [v1.8]
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function print($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$user = User::where('id',$id)->withTrashed()->first();
|
||||||
|
$assets = Asset::where('assigned_to', $id)->where('assigned_type', User::class)->with('model', 'model.category')->get();
|
||||||
|
$licenses = $user->licenses()->get();
|
||||||
|
$accessories = $user->accessories()->get();
|
||||||
|
$consumables = $user->consumables()->get();
|
||||||
|
return view('users/print')->with('assets', $assets)->with('licenses',$licenses)->with('accessories', $accessories)->with('consumables', $consumables);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ class AssetsTransformer
|
||||||
'name'=> e($asset->model->name)
|
'name'=> e($asset->model->name)
|
||||||
] : null,
|
] : null,
|
||||||
'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
|
'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
|
||||||
|
'eol' => ($asset->purchase_date!='') ? Helper::getFormattedDateObject($asset->present()->eol_date(), 'date') : null ,
|
||||||
'status_label' => ($asset->assetstatus) ? [
|
'status_label' => ($asset->assetstatus) ? [
|
||||||
'id' => (int) $asset->assetstatus->id,
|
'id' => (int) $asset->assetstatus->id,
|
||||||
'name'=> e($asset->present()->statusText),
|
'name'=> e($asset->present()->statusText),
|
||||||
|
|
|
@ -23,7 +23,7 @@ class ComponentsTransformer
|
||||||
'id' => (int) $component->id,
|
'id' => (int) $component->id,
|
||||||
'name' => e($component->name),
|
'name' => e($component->name),
|
||||||
'image' => ($component->image) ? e(url('/').'/uploads/components/'.e($component->image)) : null,
|
'image' => ($component->image) ? e(url('/').'/uploads/components/'.e($component->image)) : null,
|
||||||
'serial_number' => ($component->serial) ? e($component->serial) : null,
|
'serial' => ($component->serial) ? e($component->serial) : null,
|
||||||
'location' => ($component->location) ? [
|
'location' => ($component->location) ? [
|
||||||
'id' => (int) $component->location->id,
|
'id' => (int) $component->location->id,
|
||||||
'name' => e($component->location->name)
|
'name' => e($component->location->name)
|
||||||
|
@ -34,6 +34,10 @@ class ComponentsTransformer
|
||||||
'id' => (int) $component->category->id,
|
'id' => (int) $component->category->id,
|
||||||
'name' => e($component->category->name)
|
'name' => e($component->category->name)
|
||||||
] : null,
|
] : null,
|
||||||
|
'location' => ($component->location) ? [
|
||||||
|
'id' => (int) $component->location->id,
|
||||||
|
'name' => e($component->location->name)
|
||||||
|
] : null,
|
||||||
'order_number' => e($component->order_number),
|
'order_number' => e($component->order_number),
|
||||||
'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'),
|
'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'),
|
||||||
'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost),
|
'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost),
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ConsumablesTransformer
|
||||||
'location' => ($consumable->location) ? ['id' => (int) $consumable->location->id, 'name' => e($consumable->location->name)] : null,
|
'location' => ($consumable->location) ? ['id' => (int) $consumable->location->id, 'name' => e($consumable->location->name)] : null,
|
||||||
'manufacturer' => ($consumable->manufacturer) ? ['id' => (int) $consumable->manufacturer->id, 'name' => e($consumable->manufacturer->name)] : null,
|
'manufacturer' => ($consumable->manufacturer) ? ['id' => (int) $consumable->manufacturer->id, 'name' => e($consumable->manufacturer->name)] : null,
|
||||||
'min_amt' => (int) $consumable->min_amt,
|
'min_amt' => (int) $consumable->min_amt,
|
||||||
'model_number' => e($consumable->model_number),
|
'model_number' => ($consumable->model_number!='') ? e($consumable->model_number) : null,
|
||||||
'remaining' => $consumable->numRemaining(),
|
'remaining' => $consumable->numRemaining(),
|
||||||
'order_number' => e($consumable->order_number),
|
'order_number' => e($consumable->order_number),
|
||||||
'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost),
|
'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost),
|
||||||
|
|
|
@ -128,7 +128,11 @@ class Asset extends Depreciable
|
||||||
|
|
||||||
public function availableForCheckout()
|
public function availableForCheckout()
|
||||||
{
|
{
|
||||||
if ((empty($this->assigned_to)) && (empty($this->deleted_at)) && ($this->assetstatus->deployable == 1)) {
|
if (
|
||||||
|
(empty($this->assigned_to)) &&
|
||||||
|
(empty($this->deleted_at)) &&
|
||||||
|
(($this->assetstatus) && ($this->assetstatus->deployable == 1)))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -147,6 +147,13 @@ class AssetPresenter extends Presenter
|
||||||
"visible" => false,
|
"visible" => false,
|
||||||
"title" => trans('general.order_number'),
|
"title" => trans('general.order_number'),
|
||||||
'formatter' => "orderNumberObjFilterFormatter"
|
'formatter' => "orderNumberObjFilterFormatter"
|
||||||
|
], [
|
||||||
|
"field" => "eol",
|
||||||
|
"searchable" => false,
|
||||||
|
"sortable" => false,
|
||||||
|
"visible" => false,
|
||||||
|
"title" => trans('general.eol'),
|
||||||
|
"formatter" => "dateDisplayFormatter"
|
||||||
], [
|
], [
|
||||||
"field" => "warranty_months",
|
"field" => "warranty_months",
|
||||||
"searchable" => true,
|
"searchable" => true,
|
||||||
|
|
|
@ -50,6 +50,12 @@ class ComponentPresenter extends Presenter
|
||||||
"title" => trans('general.image'),
|
"title" => trans('general.image'),
|
||||||
"visible" => false,
|
"visible" => false,
|
||||||
"formatter" => 'imageFormatter',
|
"formatter" => 'imageFormatter',
|
||||||
|
],[
|
||||||
|
"field" => "serial",
|
||||||
|
"searchable" => true,
|
||||||
|
"sortable" => true,
|
||||||
|
"title" => trans('admin/hardware/form.serial'),
|
||||||
|
"formatter" => "componentsLinkFormatter"
|
||||||
], [
|
], [
|
||||||
"field" => "category",
|
"field" => "category",
|
||||||
"searchable" => true,
|
"searchable" => true,
|
||||||
|
@ -74,6 +80,12 @@ class ComponentPresenter extends Presenter
|
||||||
"sortable" => false,
|
"sortable" => false,
|
||||||
"title" => trans('general.min_amt'),
|
"title" => trans('general.min_amt'),
|
||||||
"visible" => true,
|
"visible" => true,
|
||||||
|
], [
|
||||||
|
"field" => "location",
|
||||||
|
"searchable" => true,
|
||||||
|
"sortable" => true,
|
||||||
|
"title" => trans('general.location'),
|
||||||
|
"formatter" => "locationsLinkObjFormatter"
|
||||||
], [
|
], [
|
||||||
"field" => "order_number",
|
"field" => "order_number",
|
||||||
"searchable" => true,
|
"searchable" => true,
|
||||||
|
|
|
@ -56,6 +56,11 @@ class ConsumablePresenter extends Presenter
|
||||||
"sortable" => true,
|
"sortable" => true,
|
||||||
"title" => trans('general.category'),
|
"title" => trans('general.category'),
|
||||||
"formatter" => "categoriesLinkObjFormatter"
|
"formatter" => "categoriesLinkObjFormatter"
|
||||||
|
],[
|
||||||
|
"field" => "model_number",
|
||||||
|
"searchable" => true,
|
||||||
|
"sortable" => true,
|
||||||
|
"title" => trans('general.model_no'),
|
||||||
],[
|
],[
|
||||||
"field" => "item_no",
|
"field" => "item_no",
|
||||||
"searchable" => true,
|
"searchable" => true,
|
||||||
|
@ -79,6 +84,19 @@ class ConsumablePresenter extends Presenter
|
||||||
"sortable" => false,
|
"sortable" => false,
|
||||||
"title" => trans('general.min_amt'),
|
"title" => trans('general.min_amt'),
|
||||||
"visible" => true,
|
"visible" => true,
|
||||||
|
], [
|
||||||
|
"field" => "location",
|
||||||
|
"searchable" => true,
|
||||||
|
"sortable" => true,
|
||||||
|
"title" => trans('general.location'),
|
||||||
|
"formatter" => "locationsLinkObjFormatter"
|
||||||
|
], [
|
||||||
|
"field" => "manufacturer",
|
||||||
|
"searchable" => true,
|
||||||
|
"sortable" => true,
|
||||||
|
"title" => trans('general.manufacturer'),
|
||||||
|
"visible" => false,
|
||||||
|
"formatter" => "manufacturersLinkObjFormatter"
|
||||||
], [
|
], [
|
||||||
"field" => "order_number",
|
"field" => "order_number",
|
||||||
"searchable" => true,
|
"searchable" => true,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
return array (
|
return array (
|
||||||
'app_version' => 'v4.1.7',
|
'app_version' => 'v4.1.8-pre',
|
||||||
'full_app_version' => 'v4.1.7 - build 3031-g4f3c932',
|
'full_app_version' => 'v4.1.8-pre - build 3034',
|
||||||
'build_version' => '3031',
|
'build_version' => '3034',
|
||||||
'prerelease_version' => '',
|
'prerelease_version' => '',
|
||||||
'hash_version' => 'g4f3c932',
|
'hash_version' => 'g4f3c932',
|
||||||
'full_hash' => 'v4.1.6-37-g4f3c932',
|
'full_hash' => 'v4.1.7-37-g4f3c932',
|
||||||
'branch' => 'master',
|
'branch' => 'master',
|
||||||
);
|
);
|
||||||
|
|
192
resources/views/users/print.blade.php
Normal file
192
resources/views/users/print.blade.php
Normal file
|
@ -0,0 +1,192 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
<title>Assigned to {{ $user->present()->fullName() }}</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: "Arial, Helvetica", sans-serif;
|
||||||
|
}
|
||||||
|
table.inventory {
|
||||||
|
border: solid #000;
|
||||||
|
border-width: 1px 1px 1px 1px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@page {
|
||||||
|
size: A4;
|
||||||
|
}
|
||||||
|
table.inventory th, table.inventory td {
|
||||||
|
border: solid #000;
|
||||||
|
border-width: 0 1px 1px 0;
|
||||||
|
padding: 3px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h3>Assigned to {{ $user->present()->fullName() }}</h3>
|
||||||
|
|
||||||
|
@if ($assets->count() > 0)
|
||||||
|
@php
|
||||||
|
$counter = 1;
|
||||||
|
@endphp
|
||||||
|
<table class="inventory">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="7">{{ trans('general.assets') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 20px;"></th>
|
||||||
|
<th style="width: 20%;">Asset Tag</th>
|
||||||
|
<th style="width: 20%;">Name</th>
|
||||||
|
<th style="width: 10%;">Category</th>
|
||||||
|
<th style="width: 20%;">Model</th>
|
||||||
|
<th style="width: 20%;">Serial</th>
|
||||||
|
<th style="width: 10%;">Checked Out</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
@foreach ($assets as $asset)
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{ $counter }}</td>
|
||||||
|
<td>{{ $asset->asset_tag }}</td>
|
||||||
|
<td>{{ $asset->name }}</td>
|
||||||
|
<td>{{ $asset->model->category->name }}</td>
|
||||||
|
<td>{{ $asset->model->name }}</td>
|
||||||
|
<td>{{ $asset->serial }}</td>
|
||||||
|
<td>
|
||||||
|
{{ $asset->last_checkout }}</td>
|
||||||
|
</tr>
|
||||||
|
@php
|
||||||
|
$counter++
|
||||||
|
@endphp
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($licenses->count() > 0)
|
||||||
|
<br><br>
|
||||||
|
<table class="inventory">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="4">{{ trans('general.licenses') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 20px;"></th>
|
||||||
|
<th style="width: 40%;">Name</th>
|
||||||
|
<th style="width: 50%;">Serial/Product Key</th>
|
||||||
|
<th style="width: 10%;">Checked Out</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
@php
|
||||||
|
$lcounter = 1;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@foreach ($licenses as $license)
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{ $lcounter }}</td>
|
||||||
|
<td>{{ $license->name }}</td>
|
||||||
|
<td>{{ $license->serial }}</td>
|
||||||
|
<td>{{ $license->assetlog->first()->created_at }}</td>
|
||||||
|
</tr>
|
||||||
|
@php
|
||||||
|
$lcounter++
|
||||||
|
@endphp
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
@if ($accessories->count() > 0)
|
||||||
|
<br><br>
|
||||||
|
<table class="inventory">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="4">{{ trans('general.accessories') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 20px;"></th>
|
||||||
|
<th style="width: 40%;">Name</th>
|
||||||
|
<th style="width: 50%;">Category</th>
|
||||||
|
<th style="width: 10%;">Checked Out</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
@php
|
||||||
|
$acounter = 1;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@foreach ($accessories as $accessory)
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{ $acounter }}</td>
|
||||||
|
<td>{{ $accessory->manufacturer->name }} {{ $accessory->name }} {{ $accessory->model_number }}</td>
|
||||||
|
<td>{{ $accessory->category->name }}</td>
|
||||||
|
<td>{{ $accessory->assetlog->first()->created_at }}</td>
|
||||||
|
</tr>
|
||||||
|
@php
|
||||||
|
$acounter++
|
||||||
|
@endphp
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($consumables->count() > 0)
|
||||||
|
<br><br>
|
||||||
|
<table class="inventory">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="4">{{ trans('general.consumables') }}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 20px;"></th>
|
||||||
|
<th style="width: 40%;">Name</th>
|
||||||
|
<th style="width: 50%;">Category</th>
|
||||||
|
<th style="width: 10%;">Checked Out</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
@php
|
||||||
|
$ccounter = 1;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@foreach ($consumables as $consumable)
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{ $ccounter }}</td>
|
||||||
|
<td>{{ $consumable->manufacturer->name }} {{ $consumable->name }} {{ $consumable->model_number }}</td>
|
||||||
|
<td>{{ $consumable->category->name }}</td>
|
||||||
|
<td>{{ $consumable->assetlog->first()->created_at }}</td>
|
||||||
|
</tr>
|
||||||
|
@php
|
||||||
|
$ccounter++
|
||||||
|
@endphp
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Signed Off By:</td>
|
||||||
|
<td>________________________________________________________</td>
|
||||||
|
<td></td>
|
||||||
|
<td>Date:</td>
|
||||||
|
<td>________________________________________________________</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -216,6 +216,10 @@
|
||||||
<div class="col-md-12" style="padding-top: 5px;">
|
<div class="col-md-12" style="padding-top: 5px;">
|
||||||
<a href="{{ route('clone/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">{{ trans('admin/users/general.clone') }}</a>
|
<a href="{{ route('clone/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">{{ trans('admin/users/general.clone') }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-12" style="padding-top: 5px;">
|
||||||
|
<a href="{{ route('users.print', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default hidden-print">Print All Assigned</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
@can('delete', $user)
|
@can('delete', $user)
|
||||||
@if ($user->deleted_at=='')
|
@if ($user->deleted_at=='')
|
||||||
<div class="col-md-12" style="padding-top: 5px;">
|
<div class="col-md-12" style="padding-top: 5px;">
|
||||||
|
|
|
@ -17,6 +17,13 @@ Route::group([ 'prefix' => 'users', 'middleware' => ['auth']], function () {
|
||||||
'{userId}/deletefile/{fileId}',
|
'{userId}/deletefile/{fileId}',
|
||||||
[ 'as' => 'userfile.destroy', 'uses' => 'UsersController@getDeleteFile' ]
|
[ 'as' => 'userfile.destroy', 'uses' => 'UsersController@getDeleteFile' ]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Route::get(
|
||||||
|
'{userId}/print',
|
||||||
|
[ 'as' => 'users.print', 'uses' => 'UsersController@print' ]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
Route::get(
|
Route::get(
|
||||||
'{userId}/showfile/{fileId}',
|
'{userId}/showfile/{fileId}',
|
||||||
[ 'as' => 'show/userfile', 'uses' => 'UsersController@displayFile' ]
|
[ 'as' => 'show/userfile', 'uses' => 'UsersController@displayFile' ]
|
||||||
|
|
Loading…
Reference in a new issue