diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php index 03e1a26e28..e0b7754837 100755 --- a/app/Http/Controllers/LocationsController.php +++ b/app/Http/Controllers/LocationsController.php @@ -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); + + } + +} \ No newline at end of file diff --git a/resources/lang/en/admin/locations/table.php b/resources/lang/en/admin/locations/table.php index ffa69307d5..1cbe540749 100644 --- a/resources/lang/en/admin/locations/table.php +++ b/resources/lang/en/admin/locations/table.php @@ -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', diff --git a/resources/views/locations/print.blade.php b/resources/views/locations/print.blade.php new file mode 100644 index 0000000000..3d20a6ce11 --- /dev/null +++ b/resources/views/locations/print.blade.php @@ -0,0 +1,188 @@ + + + + + Assigned to {{ $location->present()->fullName() }} Location + + + + +@if ($snipeSettings->logo_print_assets=='1') + @if ($snipeSettings->brand == '3') + +

+ @if ($snipeSettings->logo!='') + + @endif + {{ $snipeSettings->site_name }} +

+ @elseif ($snipeSettings->brand == '2') + @if ($snipeSettings->logo!='') + + @endif + @else +

{{ $snipeSettings->site_name }}

+ @endif +@endif + +

Asset Management System

+Assigned To: {{ $location->present()->fullName() }} + @if ($parent) + {{ $parent->present()->fullName() }} + @endif +
+@if ($manager) + Manager: {{ $manager->present()->fullName() }}
+@endif +Current Date: {{ date("d/m/Y h:i:s A") }}

+ +@if ($users->count() > 0) + @php + $counter = 1; + @endphp + + + + + + + + + + + + + + + + + @foreach ($users as $user) + + + + + + + + + + @php + $counter++ + @endphp + @endforeach +
{{ trans('general.users') }}
CompanyUser NameEmployee No.DepartmentLocation
{{ $counter }}{{ $user->company->name }}{{ $user->first_name }} {{ $user->last_name }}{{ $user->employee_num }}{{ $user->department->name }}{{ $user->location->name }}
+@endif + + + +@if ($assets->count() > 0) +

+ + + + + + + + + + + + + + + + + + + + + @php + $counter = 1; + @endphp + + @foreach ($assets as $asset) + + + + + + + + + + + + + + @php + $counter++ + @endphp + @endforeach +
{{ trans('general.assets') }}
Asset TagNameCategoryManufacturerModelSerialLocationChecked OutExpected Checkin
{{ $counter }}{{ $asset->asset_tag }}{{ $asset->name }}{{ $asset->model->category->name }}{{ $asset->model->manufacturer->name }}{{ $asset->model->name }} {{ $asset->model->model_number }}{{ $asset->serial }}{{ $asset->location->name }}{{ $asset->last_checkout }}{{ $asset->expected_checkin }}
+@endif + +
+
+
+ + + + + + + + +
Signed By (Asset Auditor):___________________________Date:____________________
+
+
+
+ + + + + + + + +
Signed By (Finance Asset Auditor):____________________Date:____________________
+
+
+
+ + + + + + + + +
Signed By (Location Manager):_______________________Date:____________________
+ + + + diff --git a/resources/views/locations/view.blade.php b/resources/views/locations/view.blade.php index 810635b871..31e6453694 100644 --- a/resources/views/locations/view.blade.php +++ b/resources/views/locations/view.blade.php @@ -9,10 +9,6 @@ @parent @stop -@section('header_right') -{{ trans('admin/locations/table.update') }} -@stop - {{-- Page content --}} @section('content') @@ -158,18 +154,23 @@ @endif - +
+ {{ trans('admin/locations/table.update') }} +
+
+ {{ trans('admin/locations/table.print_assigned') }} +
+
+ {{ trans('admin/locations/table.print_all_assigned') }} +
+ + - - - - - @stop @section('moar_scripts') diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 814f29ca72..2be381f52e 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -145,7 +145,7 @@ @can('viewKeys', $license) {{ $license->serial }} @else - ------------ + {{ str_repeat('x', 15) }} @endcan {{ $license->assetlog->first()->created_at }} diff --git a/routes/web.php b/routes/web.php index 8ef8438582..21600d9f11 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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