Merge branch 'master' of https://github.com/ajsy/snipe-it into ajsy-master

Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	resources/views/users/print.blade.php
This commit is contained in:
snipe 2021-04-05 20:55:49 -07:00
commit b9bab05ac3
6 changed files with 237 additions and 12 deletions

View file

@ -210,5 +210,29 @@ class LocationsController extends Controller
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
}
public function print_assigned($id)
{
}
$location = Location::where('id',$id)->first();
$parent = Location::where('id',$location->parent_id)->first();
$manager = User::where('id',$location->manager_id)->first();
$users = User::where('location_id', $id)->with('company', 'department', 'location')->get();
$assets = Asset::where('assigned_to', $id)->where('assigned_type', Location::class)->with('model', 'model.category')->get();
return view('locations/print')->with('assets', $assets)->with('users',$users)->with('location', $location)->with('parent', $parent)->with('manager', $manager);
}
public function print_all_assigned($id)
{
$location = Location::where('id',$id)->first();
$parent = Location::where('id',$location->parent_id)->first();
$manager = User::where('id',$location->manager_id)->first();
$users = User::where('location_id', $id)->with('company', 'department', 'location')->get();
$assets = Asset::where('location_id', $id)->with('model', 'model.category')->get();
return view('locations/print')->with('assets', $assets)->with('users',$users)->with('location', $location)->with('parent', $parent)->with('manager', $manager);
}
}

View file

@ -11,6 +11,8 @@ return array(
'country' => 'Country',
'create' => 'Create Location',
'update' => 'Update Location',
'print_assigned' => 'Print Assigned',
'print_all_assigned' => 'Print All Assigned',
'name' => 'Location Name',
'address' => 'Address',
'zip' => 'Postal Code',

View file

@ -0,0 +1,188 @@
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Assigned to {{ $location->present()->fullName() }} Location</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;
}
.print-logo {
max-height: 40px;
}
</style>
</head>
<body>
@if ($snipeSettings->logo_print_assets=='1')
@if ($snipeSettings->brand == '3')
<h3>
@if ($snipeSettings->logo!='')
<img class="print-logo" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
@endif
{{ $snipeSettings->site_name }}
</h3>
@elseif ($snipeSettings->brand == '2')
@if ($snipeSettings->logo!='')
<img class="print-logo" src="{{ url('/') }}/uploads/{{ $snipeSettings->logo }}">
@endif
@else
<h3>{{ $snipeSettings->site_name }}</h3>
@endif
@endif
<h2>Asset Management System</h2>
<b>Assigned To:</b> {{ $location->present()->fullName() }}
@if ($parent)
{{ $parent->present()->fullName() }}
@endif
<br>
@if ($manager)
<b>Manager:</b> {{ $manager->present()->fullName() }}<br>
@endif
<b>Current Date:</b> {{ date("d/m/Y h:i:s A") }}<br><br>
@if ($users->count() > 0)
@php
$counter = 1;
@endphp
<table class="inventory">
<thead>
<tr>
<th colspan="6">{{ trans('general.users') }}</th>
</tr>
</thead>
<thead>
<tr>
<th style="width: 5px;"></th>
<th style="width: 25%;">Company</th>
<th style="width: 25%;">User Name</th>
<th style="width: 10%;">Employee No.</th>
<th style="width: 20%;">Department</th>
<th style="width: 20%;">Location</th>
</tr>
</thead>
@foreach ($users as $user)
<tr>
<td>{{ $counter }}</td>
<td>{{ $user->company->name }}</td>
<td>{{ $user->first_name }} {{ $user->last_name }}</td>
<td>{{ $user->employee_num }}</td>
<td>{{ $user->department->name }}</td>
<td>{{ $user->location->name }}</td>
</tr>
@php
$counter++
@endphp
@endforeach
</table>
@endif
@if ($assets->count() > 0)
<br><br>
<table class="inventory">
<thead>
<tr>
<th colspan="10">{{ trans('general.assets') }}</th>
</tr>
</thead>
<thead>
<tr>
<th style="width: 20px;"></th>
<th style="width: 10%;">Asset Tag</th>
<th style="width: 10%;">Name</th>
<th style="width: 10%;">Category</th>
<th style="width: 10%;">Manufacturer</th>
<th style="width: 15%;">Model</th>
<th style="width: 15%;">Serial</th>
<th style="width: 10%;">Location</th>
<th style="width: 10%;">Checked Out</th>
<th style="width: 10%;">Expected Checkin</th>
</tr>
</thead>
@php
$counter = 1;
@endphp
@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->manufacturer->name }}</td>
<td>{{ $asset->model->name }} {{ $asset->model->model_number }}</td>
<td>{{ $asset->serial }}</td>
<td>{{ $asset->location->name }}</td>
<td>{{ $asset->last_checkout }}</td>
<td>{{ $asset->expected_checkin }}</td>
</tr>
@php
$counter++
@endphp
@endforeach
</table>
@endif
<br>
<br>
<br>
<table>
<tr>
<td>Signed By (Asset Auditor):</td>
<td>___________________________</td>
<td></td>
<td>Date:</td>
<td>____________________</td>
</tr>
</table>
<br>
<br>
<br>
<table>
<tr>
<td>Signed By (Finance Asset Auditor):</td>
<td>____________________</td>
<td></td>
<td>Date:</td>
<td>____________________</td>
</tr>
</table>
<br>
<br>
<br>
<table>
<tr>
<td>Signed By (Location Manager):</td>
<td>_______________________</td>
<td></td>
<td>Date:</td>
<td>____________________</td>
</tr>
</table>
</body>
</html>

View file

@ -9,10 +9,6 @@
@parent
@stop
@section('header_right')
<a href="{{ route('locations.edit', ['location' => $location->id]) }}" class="btn btn-sm btn-primary pull-right">{{ trans('admin/locations/table.update') }} </a>
@stop
{{-- Page content --}}
@section('content')
@ -158,18 +154,23 @@
</div>
@endif
</div>
<div class="col-md-12">
<a href="{{ route('locations.edit', ['location' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-primary pull-left">{{ trans('admin/locations/table.update') }} </a>
</div>
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('locations.print_assigned', ['location' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_assigned') }} </a>
</div>
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('locations.print_all_assigned', ['location' => $location->id]) }}" style="width: 50%;" class="btn btn-sm btn-default pull-left">{{ trans('admin/locations/table.print_all_assigned') }} </a>
</div>
</div>
</div>
</div>
</div>
@stop
@section('moar_scripts')

View file

@ -145,7 +145,7 @@
@can('viewKeys', $license)
{{ $license->serial }}
@else
------------
<i class="fa-lock" aria-hidden="true"></i> {{ str_repeat('x', 15) }}
@endcan
</td>
<td>{{ $license->assetlog->first()->created_at }}</td>

View file

@ -22,6 +22,16 @@ Route::group(['middleware' => 'auth'], function () {
Route::resource('locations', 'LocationsController', [
'parameters' => ['location' => 'location_id']
]);
Route::get(
'locations/{locationId}/printassigned',
[ 'as' => 'locations.print_assigned', 'uses' => 'LocationsController@print_assigned' ]
);
Route::get(
'locations/{locationId}/printallassigned',
[ 'as' => 'locations.print_all_assigned', 'uses' => 'LocationsController@print_all_assigned' ]
);
/*
* Manufacturers