diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php index 7dc56e9b96..3457e115f9 100755 --- a/app/Http/Controllers/LocationsController.php +++ b/app/Http/Controllers/LocationsController.php @@ -253,23 +253,41 @@ class LocationsController extends Controller $this->authorize('view', Location::class); if ($location = Location::where('id', $id)->first()) { - $parent = Location::where('id', $location->parent_id)->first(); - $manager = User::where('id', $location->manager_id)->first(); - $company = Company::where('id', $location->company_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('assigned', false) + ->with('assets', $location->assets) + ->with('assignedAssets', $location->assignedAssets) + ->with('accessories', $location->accessories) + ->with('assignedAccessories', $location->assignedAccessories) + ->with('users',$location->users) ->with('location', $location) - ->with('parent', $parent) - ->with('manager', $manager) - ->with('company', $company); + ->with('consumables', $location->consumables) + ->with('components', $location->components) + ->with('children', $location->children); } return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist')); } + public function print_all_assigned($id) : View | RedirectResponse + { + $this->authorize('view', Location::class); + if ($location = Location::where('id', $id)->first()) { + return view('locations/print') + ->with('assigned', true) + ->with('assets', $location->assets) + ->with('assignedAssets', $location->assignedAssets) + ->with('accessories', $location->accessories) + ->with('assignedAccessories', $location->assignedAccessories) + ->with('users',$location->users) + ->with('location', $location) + ->with('consumables', $location->consumables) + ->with('components', $location->components) + ->with('children', $location->children); + } + return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist')); + } + /** * Returns a view that presents a form to clone a location. @@ -333,26 +351,6 @@ class LocationsController extends Controller return redirect()->back()->with('error', trans('admin/models/message.does_not_exist')); } - public function print_all_assigned($id) : View | RedirectResponse - { - $this->authorize('view', Location::class); - if ($location = Location::where('id', $id)->first()) { - $parent = Location::where('id', $location->parent_id)->first(); - $manager = User::where('id', $location->manager_id)->first(); - $company = Company::where('id', $location->company_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) - ->with('company', $company); - } - return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist')); - } - /** * Returns a view that allows the user to bulk delete locations diff --git a/resources/lang/en-US/admin/locations/table.php b/resources/lang/en-US/admin/locations/table.php index 53176d8a4e..d7128b30f7 100644 --- a/resources/lang/en-US/admin/locations/table.php +++ b/resources/lang/en-US/admin/locations/table.php @@ -12,7 +12,8 @@ return [ 'create' => 'Create Location', 'update' => 'Update Location', 'print_assigned' => 'Print Assigned', - 'print_all_assigned' => 'Print All Assigned', + 'print_inventory' => 'Print Inventory', + 'print_all_assigned' => 'Print Inventory and Assigned', 'name' => 'Location Name', 'address' => 'Address', 'address2' => 'Address Line 2', diff --git a/resources/lang/en-US/admin/models/table.php b/resources/lang/en-US/admin/models/table.php index 11a512b3d3..20af866dde 100644 --- a/resources/lang/en-US/admin/models/table.php +++ b/resources/lang/en-US/admin/models/table.php @@ -11,7 +11,6 @@ return array( 'title' => 'Asset Models', 'update' => 'Update Asset Model', 'view' => 'View Asset Model', - 'update' => 'Update Asset Model', - 'clone' => 'Clone Model', - 'edit' => 'Edit Model', + 'clone' => 'Clone Model', + 'edit' => 'Edit Model', ); diff --git a/resources/lang/en-US/general.php b/resources/lang/en-US/general.php index 3516203331..a57c7c9f3a 100644 --- a/resources/lang/en-US/general.php +++ b/resources/lang/en-US/general.php @@ -614,6 +614,7 @@ return [ 'footer_credit' => 'Snipe-IT is open source software, made with love by @snipeitapp.com.', 'set_password' => 'Set a Password', 'upload_deleted' => 'Upload Deleted', + 'child_locations' => 'Child Locations', // Add form placeholders here 'placeholders' => [ diff --git a/resources/views/locations/print.blade.php b/resources/views/locations/print.blade.php index 6f383468b2..76f8b175e9 100644 --- a/resources/views/locations/print.blade.php +++ b/resources/views/locations/print.blade.php @@ -49,107 +49,359 @@ @endif @endif -
| {{ trans('general.users') }} | +|||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ trans('general.users') }} | ++ | {{ trans('general.company') }} | +{{ trans('admin/locations/table.user_name') }} | +{{ trans('general.employee_number') }} | +{{ trans('admin/locations/table.department') }} | +{{ trans('admin/locations/table.location') }} | |||||
| - | {{ trans('general.company') }} | -{{ trans('admin/locations/table.user_name') }} | -{{ trans('general.employee_number') }} | -{{ trans('admin/locations/table.department') }} | -{{ trans('admin/locations/table.location') }} | -||||||
| {{ $counter }} | -{{ (($user) && ($user->company)) ? $user->company->name : '' }} | -{{ ($user) ? $user->first_name .' '. $user->last_name : '' }} | -{{ ($user) ? $user->employee_num : '' }} | -{{ (($user) && ($user->department)) ? $user->department->name : '' }} | -{{ (($user) && ($user->location)) ? $user->location->name : '' }} | -||||||
| {{ trans('general.assets') }} | +{{ trans('general.child_locations') }} | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| - | {{ trans('admin/locations/table.asset_tag') }} | -{{ trans('admin/locations/table.asset_name') }} | -{{ trans('admin/locations/table.asset_category') }} | -{{ trans('admin/locations/table.asset_manufacturer') }} | -{{ trans('admin/locations/table.asset_model') }} | -{{ trans('admin/locations/table.asset_serial') }} | -{{ trans('admin/locations/table.asset_location') }} | -{{ trans('admin/locations/table.asset_checked_out') }} | -{{ trans('admin/locations/table.asset_expected_checkin') }} | -||||||||||
| {{ $counter }} | -{{ $asset->asset_tag }} | -{{ $asset->name }} | -{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : '' }} | -{{ (($asset->model) && ($asset->model->manufacturer)) ? $asset->model->manufacturer->name : '' }} | -{{ ($asset->model) ? $asset->model->name : '' }} | -{{ $asset->serial }} | -{{ ($asset->location) ? $asset->location->name : '' }} | -{{ \App\Helpers\Helper::getFormattedDateObject( $asset->last_checkout, 'datetime', false) }} | -{{ \App\Helpers\Helper::getFormattedDateObject( $asset->expected_checkin, 'datetime', false) }} | ++ | {{ trans('general.name') }} | +{{ trans('general.address') }} | +{{ trans('general.city') }} | +{{ trans('general.state') }} | +{{ trans('general.country') }} | +{{ trans('general.zip') }} | +|||
| {{ $counter }} | +{{ $child->name }} | +{{ $child->address }} | +{{ $child->city }} | +{{ $child->state }} | +{{ $child->country }} | +{{ $child->zip }} | +|||||||||||||
| {{ trans('general.assets') }} | +|||||||||
|---|---|---|---|---|---|---|---|---|---|
| + | {{ trans('admin/locations/table.asset_tag') }} | +{{ trans('admin/locations/table.asset_name') }} | +{{ trans('admin/locations/table.asset_category') }} | +{{ trans('admin/locations/table.asset_manufacturer') }} | +{{ trans('admin/locations/table.asset_model') }} | +{{ trans('admin/locations/table.asset_serial') }} | +{{ trans('admin/locations/table.asset_location') }} | +{{ trans('admin/locations/table.asset_checked_out') }} | +{{ trans('admin/locations/table.asset_expected_checkin') }} | +
| {{ $counter }} | +{{ $asset->asset_tag }} | +{{ $asset->name }} | +{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : '' }} | +{{ (($asset->model) && ($asset->model->manufacturer)) ? $asset->model->manufacturer->name : '' }} | +{{ ($asset->model) ? $asset->model->name : '' }} | +{{ $asset->serial }} | +{{ ($asset->location) ? $asset->location->name : '' }} | +{{ \App\Helpers\Helper::getFormattedDateObject( $asset->last_checkout, 'datetime', false) }} | +{{ \App\Helpers\Helper::getFormattedDateObject( $asset->expected_checkin, 'datetime', false) }} | +
| {{ trans('admin/locations/message.assigned_assets') }} | +|||||||||
|---|---|---|---|---|---|---|---|---|---|
| + | {{ trans('admin/locations/table.asset_tag') }} | +{{ trans('admin/locations/table.asset_name') }} | +{{ trans('admin/locations/table.asset_category') }} | +{{ trans('admin/locations/table.asset_manufacturer') }} | +{{ trans('admin/locations/table.asset_model') }} | +{{ trans('admin/locations/table.asset_serial') }} | +{{ trans('admin/locations/table.asset_location') }} | +{{ trans('admin/locations/table.asset_checked_out') }} | +{{ trans('admin/locations/table.asset_expected_checkin') }} | +
| {{ $counter }} | +{{ $asset->asset_tag }} | +{{ $asset->name }} | +{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : '' }} | +{{ (($asset->model) && ($asset->model->manufacturer)) ? $asset->model->manufacturer->name : '' }} | +{{ ($asset->model) ? $asset->model->name : '' }} | +{{ $asset->serial }} | +{{ ($asset->location) ? $asset->location->name : '' }} | +{{ \App\Helpers\Helper::getFormattedDateObject( $asset->last_checkout, 'datetime', false) }} | +{{ \App\Helpers\Helper::getFormattedDateObject( $asset->expected_checkin, 'datetime', false) }} | +
| {{ trans('general.accessories') }} | +|||||||||
|---|---|---|---|---|---|---|---|---|---|
| + | {{ trans('admin/locations/table.asset_name') }} | +{{ trans('admin/locations/table.asset_category') }} | +{{ trans('admin/locations/table.asset_manufacturer') }} | +{{ trans('admin/models/table.modelnumber') }} | +{{ trans('admin/locations/table.asset_location') }} | +||||
| {{ $counter }} | +{{ $accessory->name }} | +{{ ($accessory->category) ? $accessory->category->name : '' }} | +{{ ($accessory->manufacturer) ? $accessory->manufacturer->name : '' }} | +{{ $asset->model_number }} | +{{ ($asset->location) ? $asset->location->name : '' }} | +||||
| {{ trans('general.accessories_assigned') }} | +|||||||||
|---|---|---|---|---|---|---|---|---|---|
| + | {{ trans('admin/locations/table.asset_name') }} | +{{ trans('admin/locations/table.asset_category') }} | +{{ trans('admin/locations/table.asset_manufacturer') }} | +{{ trans('admin/models/table.modelnumber') }} | +{{ trans('admin/locations/table.asset_location') }} | +||||
| {{ $counter }} | +{{ $accessory->name }} | +{{ ($accessory->category) ? $accessory->category->name : '' }} | +{{ ($accessory->manufacturer) ? $accessory->manufacturer->name : '' }} | +{{ $asset->model_number }} | +{{ ($asset->location) ? $asset->location->name : '' }} | +||||
| {{ trans('general.accessories') }} | +|||||||||
|---|---|---|---|---|---|---|---|---|---|
| + | {{ trans('admin/locations/table.asset_name') }} | +{{ trans('general.qty') }} | +{{ trans('admin/locations/table.asset_category') }} | +{{ trans('admin/locations/table.asset_manufacturer') }} | +{{ trans('admin/models/table.modelnumber') }} | +||||
| {{ $counter }} | +{{ $consumable->name }} | +{{ $consumable->qty }} | +{{ ($consumable->category) ? $consumable->category->name : '' }} | +{{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} | +{{ $consumable->model_number }} | +||||
| {{ trans('general.components') }} | +|||||||||
|---|---|---|---|---|---|---|---|---|---|
| + | {{ trans('admin/locations/table.asset_name') }} | +{{ trans('general.qty') }} | +{{ trans('admin/locations/table.asset_category') }} | +{{ trans('admin/locations/table.asset_manufacturer') }} | +{{ trans('admin/models/table.modelnumber') }} | +||||
| {{ $counter }} | +{{ $component->name }} | +{{ $component->qty }} | +{{ ($component->category) ? $component->category->name : '' }} | +{{ ($component->manufacturer) ? $component->manufacturer->name : '' }} | +{{ $component->model_number }} | +||||
| {{ trans('admin/locations/table.signed_by_asset_auditor') }} | ------------------------------------------------------- |
- {{ trans('admin/locations/table.date') }} | ------------------------------- |
-
| {{ trans('admin/locations/table.signed_by_asset_auditor') }} | +------------------------------------------------------ |
+ {{ trans('admin/locations/table.date') }} | +------------------------------ |
+
| {{ trans('admin/locations/table.signed_by_finance_auditor') }} | ------------------------------------------------------- |
- {{ trans('admin/locations/table.date') }} | ------------------------------- |
-
| {{ trans('admin/locations/table.signed_by_finance_auditor') }} | +------------------------------------------------------ |
+ {{ trans('admin/locations/table.date') }} | +------------------------------ |
+
| {{ trans('admin/locations/table.signed_by_location_manager') }} | ------------------------------------------------------- |
- {{ trans('admin/locations/table.date') }} | ------------------------------- |
-
| {{ trans('admin/locations/table.signed_by_location_manager') }} | +------------------------------------------------------ |
+ {{ trans('admin/locations/table.date') }} | +------------------------------ |
+