Skip to content

A free open source IT asset/license management system

Cleaned up print view

snipe0004d4936caf
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' => '<a target="_blank" href="https://snipeitapp.com" rel="noopener">Snipe-IT</a> is open source software, made with <i class="fa fa-heart" aria-hidden="true" style="color: #a94442; font-size: 10px" /></i><span class="sr-only">love</span> by <a href="https://bsky.app/profile/snipeitapp.com" rel="noopener">@snipeitapp.com</a>.',
'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
-<h2>{{ trans('general.assigned_to', array('name' => $location->display_name)) }}</h2>
- @if ($parent)
- {{ $parent->display_name }}
+<h2>
+ @if ($assigned)
+ {{ trans('general.assigned_to', array('name' => $location->display_name)) }}
+ @else
+ {{ trans('admin/locations/table.print_inventory') }} : {{ $location->display_name }}
@endif
+ </h2>
+ @if ($location->parent)
+ <strong>{{ trans('admin/locations/table.parent') }}:</strong> {{ $location->parent->display_name }}
+@endif
<br>
-@if ($company)
- <b>{{ trans('admin/companies/table.name') }}:</b> {{ $company->display_name }}
+@if ($location->company)
+<b>{{ trans('admin/companies/table.name') }}:</b> {{ $location->company->display_name }}
<br>
@endif
-@if ($manager)
- <b>{{ trans('general.manager') }}</b> {{ $manager->display_name }}<br>
+@if ($location->manager)
+<b>{{ trans('admin/users/table.manager') }}:</b> {{ $location->manager->display_name }}<br>
@endif
-<b>{{ trans('general.date') }}</b> {{ \App\Helpers\Helper::getFormattedDateObject(now(), 'datetime', false) }}<br><br>
+<b>{{ trans('general.date') }}:</b> {{ \App\Helpers\Helper::getFormattedDateObject(now(), 'datetime', false) }}<br><br>
@if ($users->count() > 0)
- @php
- $counter = 1;
- @endphp
+@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%;">{{ trans('general.company') }}</th>
+ <th style="width: 25%;">{{ trans('admin/locations/table.user_name') }}</th>
+ <th style="width: 10%;">{{ trans('general.employee_number') }}</th>
+ <th style="width: 20%;">{{ trans('admin/locations/table.department') }}</th>
+ <th style="width: 20%;">{{ trans('admin/locations/table.location') }}</th>
+ </tr>
+ </thead>
+@foreach ($users as $user)
+
+ <tr>
+ <td>{{ $counter }}</td>
+ <td>{{ (($user) && ($user->company)) ? $user->company->name : '' }}</td>
+ <td>{{ ($user) ? $user->first_name .' '. $user->last_name : '' }}</td>
+ <td>{{ ($user) ? $user->employee_num : '' }}</td>
+ <td>{{ (($user) && ($user->department)) ? $user->department->name : '' }}</td>
+ <td>{{ (($user) && ($user->location)) ? $user->location->name : '' }}</td>
+ </tr>
+ @php
+ $counter++
+ @endphp
+@endforeach
+</table>
+@endif
+
+@if ($children->count() > 0)
+ <br><br>
<table class="inventory">
<thead>
<tr>
- <th colspan="6">{{ trans('general.users') }}</th>
+ <th colspan="10">{{ trans('general.child_locations') }}</th>
</tr>
</thead>
<thead>
- <tr>
- <th style="width: 5px;"></th>
- <th style="width: 25%;">{{ trans('general.company') }}</th>
- <th style="width: 25%;">{{ trans('admin/locations/table.user_name') }}</th>
- <th style="width: 10%;">{{ trans('general.employee_number') }}</th>
- <th style="width: 20%;">{{ trans('admin/locations/table.department') }}</th>
- <th style="width: 20%;">{{ trans('admin/locations/table.location') }}</th>
- </tr>
- </thead>
- @foreach ($users as $user)
-
<tr>
- <td>{{ $counter }}</td>
- <td>{{ (($user) && ($user->company)) ? $user->company->name : '' }}</td>
- <td>{{ ($user) ? $user->first_name .' '. $user->last_name : '' }}</td>
- <td>{{ ($user) ? $user->employee_num : '' }}</td>
- <td>{{ (($user) && ($user->department)) ? $user->department->name : '' }}</td>
- <td>{{ (($user) && ($user->location)) ? $user->location->name : '' }}</td>
+ <th style="width: 20px;"></th>
+ <th>{{ trans('general.name') }}</th>
+ <th>{{ trans('general.address') }}</th>
+ <th>{{ trans('general.city') }}</th>
+ <th>{{ trans('general.state') }}</th>
+ <th>{{ trans('general.country') }}</th>
+ <th>{{ trans('general.zip') }}</th>
+
</tr>
+ </thead>
+ @php
+ $counter = 1;
+ @endphp
+
+ @foreach ($children as $child)
+ <tr>
+ <td>{{ $counter }}</td>
+ <td>{{ $child->name }}</td>
+ <td>{{ $child->address }}</td>
+ <td>{{ $child->city }}</td>
+ <td>{{ $child->state }}</td>
+ <td>{{ $child->country }}</td>
+ <td>{{ $child->zip }}</td>
+ </tr>
@php
$counter++
@endphp
- @endforeach
+ @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%;">{{ trans('admin/locations/table.asset_tag') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_name') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_category') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_manufacturer') }}</th>
+ <th style="width: 15%;">{{ trans('admin/locations/table.asset_model') }}</th>
+ <th style="width: 15%;">{{ trans('admin/locations/table.asset_serial') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_location') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_checked_out') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_expected_checkin') }}</th>
+ </tr>
+ </thead>
+ @php
+ $counter = 1;
+ @endphp
+ @foreach ($assets as $asset)
+ @php
+ if($snipeSettings->show_archived_in_list != 1 && $asset->assetstatus?->archived == 1){
+ continue;
+ }
+ @endphp
+ <tr>
+ <td>{{ $counter }}</td>
+ <td>{{ $asset->asset_tag }}</td>
+ <td>{{ $asset->name }}</td>
+ <td>{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : '' }}</td>
+ <td>{{ (($asset->model) && ($asset->model->manufacturer)) ? $asset->model->manufacturer->name : '' }}</td>
+ <td>{{ ($asset->model) ? $asset->model->name : '' }}</td>
+ <td>{{ $asset->serial }}</td>
+ <td>{{ ($asset->location) ? $asset->location->name : '' }}</td>
+ <td>{{ \App\Helpers\Helper::getFormattedDateObject( $asset->last_checkout, 'datetime', false) }}</td>
+ <td>{{ \App\Helpers\Helper::getFormattedDateObject( $asset->expected_checkin, 'datetime', false) }}</td>
+ </tr>
+ @php
+ $counter++
+ @endphp
+@endforeach
+</table>
+@endif
-@if ($assets->count() > 0)
+@if ($assigned)
+ @if ($assignedAssets->count() > 0)
+ <br><br>
+ <table class="inventory">
+ <thead>
+ <tr>
+ <th colspan="10">{{ trans('admin/locations/message.assigned_assets') }}</th>
+ </tr>
+ </thead>
+ <thead>
+ <tr>
+ <th style="width: 20px;"></th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_tag') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_name') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_category') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_manufacturer') }}</th>
+ <th style="width: 15%;">{{ trans('admin/locations/table.asset_model') }}</th>
+ <th style="width: 15%;">{{ trans('admin/locations/table.asset_serial') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_location') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_checked_out') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_expected_checkin') }}</th>
+ </tr>
+ </thead>
+ @php
+ $counter = 1;
+ @endphp
+
+ @foreach ($assignedAssets as $asset)
+ @php
+ if($snipeSettings->show_archived_in_list != 1 && $asset->assetstatus?->archived == 1){
+ continue;
+ }
+ @endphp
+ <tr>
+ <td>{{ $counter }}</td>
+ <td>{{ $asset->asset_tag }}</td>
+ <td>{{ $asset->name }}</td>
+ <td>{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : '' }}</td>
+ <td>{{ (($asset->model) && ($asset->model->manufacturer)) ? $asset->model->manufacturer->name : '' }}</td>
+ <td>{{ ($asset->model) ? $asset->model->name : '' }}</td>
+ <td>{{ $asset->serial }}</td>
+ <td>{{ ($asset->location) ? $asset->location->name : '' }}</td>
+ <td>{{ \App\Helpers\Helper::getFormattedDateObject( $asset->last_checkout, 'datetime', false) }}</td>
+ <td>{{ \App\Helpers\Helper::getFormattedDateObject( $asset->expected_checkin, 'datetime', false) }}</td>
+ </tr>
+ @php
+ $counter++
+ @endphp
+ @endforeach
+ </table>
+ @endif
+@endif
+
+@if ($accessories->count() > 0)
<br><br>
<table class="inventory">
<thead>
<tr>
- <th colspan="10">{{ trans('general.assets') }}</th>
+ <th colspan="10">{{ trans('general.accessories') }}</th>
</tr>
</thead>
<thead>
- <tr>
+ <tr>
<th style="width: 20px;"></th>
- <th style="width: 10%;">{{ trans('admin/locations/table.asset_tag') }}</th>
<th style="width: 10%;">{{ trans('admin/locations/table.asset_name') }}</th>
<th style="width: 10%;">{{ trans('admin/locations/table.asset_category') }}</th>
- <th style="width: 10%;">{{ trans('admin/locations/table.asset_manufacturer') }}</th>
- <th style="width: 15%;">{{ trans('admin/locations/table.asset_model') }}</th>
- <th style="width: 15%;">{{ trans('admin/locations/table.asset_serial') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_manufacturer') }}</th>
+ <th>{{ trans('admin/models/table.modelnumber') }}</th>
<th style="width: 10%;">{{ trans('admin/locations/table.asset_location') }}</th>
- <th style="width: 10%;">{{ trans('admin/locations/table.asset_checked_out') }}</th>
- <th style="width: 10%;">{{ trans('admin/locations/table.asset_expected_checkin') }}</th>
+ </tr>
+ </thead>
+ @php
+ $counter = 1;
+ @endphp
+
+ @foreach ($accessories as $accessory)
+ <tr>
+ <td>{{ $counter }}</td>
+ <td>{{ $accessory->name }}</td>
+ <td>{{ ($accessory->category) ? $accessory->category->name : '' }}</td>
+ <td>{{ ($accessory->manufacturer) ? $accessory->manufacturer->name : '' }}</td>
+ <td>{{ $asset->model_number }}</td>
+ <td>{{ ($asset->location) ? $asset->location->name : '' }}</td>
+ </tr>
+ @php
+ $counter++
+ @endphp
+ @endforeach
+ </table>
+@endif
+
+@if ($assigned)
+ @if ($assignedAccessories->count() > 0)
+ <br><br>
+ <table class="inventory">
+ <thead>
+ <tr>
+ <th colspan="10">{{ trans('general.accessories_assigned') }}</th>
</tr>
+ </thead>
+ <thead>
+ <tr>
+ <th style="width: 20px;"></th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_name') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_category') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_manufacturer') }}</th>
+ <th>{{ trans('admin/models/table.modelnumber') }}</th>
+ <th style="width: 10%;">{{ trans('admin/locations/table.asset_location') }}</th>
+ </tr>
+ </thead>
+ @php
+ $counter = 1;
+ @endphp
+
+ @foreach ($assignedAccessories as $accessory)
+ <tr>
+ <td>{{ $counter }}</td>
+ <td>{{ $accessory->name }}</td>
+ <td>{{ ($accessory->category) ? $accessory->category->name : '' }}</td>
+ <td>{{ ($accessory->manufacturer) ? $accessory->manufacturer->name : '' }}</td>
+ <td>{{ $asset->model_number }}</td>
+ <td>{{ ($asset->location) ? $asset->location->name : '' }}</td>
+ </tr>
+ @php
+ $counter++
+ @endphp
+ @endforeach
+ </table>
+ @endif
+@endif
+
+@if ($consumables->count() > 0)
+ <br><br>
+ <table class="inventory">
+ <thead>
+ <tr>
+ <th colspan="10">{{ trans('general.accessories') }}</th>
+ </tr>
</thead>
- @php
- $counter = 1;
- @endphp
-
- @foreach ($assets as $asset)
+ <thead>
+ <tr>
+ <th style="width: 20px;"></th>
+ <th>{{ trans('admin/locations/table.asset_name') }}</th>
+ <th>{{ trans('general.qty') }}</th>
+ <th>{{ trans('admin/locations/table.asset_category') }}</th>
+ <th>{{ trans('admin/locations/table.asset_manufacturer') }}</th>
+ <th>{{ trans('admin/models/table.modelnumber') }}</th>
+ </tr>
+ </thead>
+ @php
+ $counter = 1;
+ @endphp
+
+ @foreach ($consumables as $consumable)
+ <tr>
+ <td>{{ $counter }}</td>
+ <td>{{ $consumable->name }}</td>
+ <td>{{ $consumable->qty }}</td>
+ <td>{{ ($consumable->category) ? $consumable->category->name : '' }}</td>
+ <td>{{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }}</td>
+ <td>{{ $consumable->model_number }}</td>
+ </tr>
@php
- if($snipeSettings->show_archived_in_list != 1 && $asset->assetstatus?->archived == 1){
- continue;
- }
+ $counter++
@endphp
+ @endforeach
+ </table>
+@endif
+
+@if ($components->count() > 0)
+ <br><br>
+ <table class="inventory">
+ <thead>
+ <tr>
+ <th colspan="10">{{ trans('general.components') }}</th>
+ </tr>
+ </thead>
+ <thead>
<tr>
- <td>{{ $counter }}</td>
- <td>{{ $asset->asset_tag }}</td>
- <td>{{ $asset->name }}</td>
- <td>{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : '' }}</td>
- <td>{{ (($asset->model) && ($asset->model->manufacturer)) ? $asset->model->manufacturer->name : '' }}</td>
- <td>{{ ($asset->model) ? $asset->model->name : '' }}</td>
- <td>{{ $asset->serial }}</td>
- <td>{{ ($asset->location) ? $asset->location->name : '' }}</td>
- <td>{{ \App\Helpers\Helper::getFormattedDateObject( $asset->last_checkout, 'datetime', false) }}</td>
- <td>{{ \App\Helpers\Helper::getFormattedDateObject( $asset->expected_checkin, 'datetime', false) }}</td>
+ <th style="width: 20px;"></th>
+ <th>{{ trans('admin/locations/table.asset_name') }}</th>
+ <th>{{ trans('general.qty') }}</th>
+ <th>{{ trans('admin/locations/table.asset_category') }}</th>
+ <th>{{ trans('admin/locations/table.asset_manufacturer') }}</th>
+ <th>{{ trans('admin/models/table.modelnumber') }}</th>
</tr>
+ </thead>
+ @php
+ $counter = 1;
+ @endphp
+
+ @foreach ($components as $component)
+ <tr>
+ <td>{{ $counter }}</td>
+ <td>{{ $component->name }}</td>
+ <td>{{ $component->qty }}</td>
+ <td>{{ ($component->category) ? $component->category->name : '' }}</td>
+ <td>{{ ($component->manufacturer) ? $component->manufacturer->name : '' }}</td>
+ <td>{{ $component->model_number }}</td>
+ </tr>
@php
$counter++
@endphp
- @endforeach
+ @endforeach
</table>
@endif
@@ -157,26 +409,26 @@
<br>
<br>
<table>
- <tr>
- <td>{{ trans('admin/locations/table.signed_by_asset_auditor') }}</td>
- <td><br>------------------------------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
- <td>{{ trans('admin/locations/table.date') }}</td>
- <td><br>------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
- </tr>
+<tr>
+ <td>{{ trans('admin/locations/table.signed_by_asset_auditor') }}</td>
+ <td><br>------------------------------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
+ <td>{{ trans('admin/locations/table.date') }}</td>
+ <td><br>------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
+</tr>
- <tr>
- <td>{{ trans('admin/locations/table.signed_by_finance_auditor') }}</td>
- <td><br>------------------------------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
- <td>{{ trans('admin/locations/table.date') }}</td>
- <td><br>------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
- </tr>
+<tr>
+ <td>{{ trans('admin/locations/table.signed_by_finance_auditor') }}</td>
+ <td><br>------------------------------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
+ <td>{{ trans('admin/locations/table.date') }}</td>
+ <td><br>------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
+</tr>
- <tr>
- <td>{{ trans('admin/locations/table.signed_by_location_manager') }}</td>
- <td><br>------------------------------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
- <td>{{ trans('admin/locations/table.date') }}</td>
- <td><br>------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
- </tr>
+<tr>
+ <td>{{ trans('admin/locations/table.signed_by_location_manager') }}</td>
+ <td><br>------------------------------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
+ <td>{{ trans('admin/locations/table.date') }}</td>
+ <td><br>------------------------------ &nbsp;&nbsp;&nbsp;<br></td>
+</tr>
</table>
diff --git a/resources/views/locations/view.blade.php b/resources/views/locations/view.blade.php
index 2f13a804d6..f912e921a4 100644
--- a/resources/views/locations/view.blade.php
+++ b/resources/views/locations/view.blade.php
@@ -42,7 +42,7 @@
<span class="sr-only">
{{ trans('general.users') }}
</span>
- {!! ($location->users->count() > 0) ? '<span class="badge">'.number_format($location->users->count()).'</span>' : '' !!}
+ {!! ($location->users()->count() > 0) ? '<span class="badge">'.number_format($location->users()->count()).'</span>' : '' !!}
</a>
</li>
@endcan
@@ -83,7 +83,7 @@
<li>
<a href="#accessories" data-toggle="tab" data-tooltip="true" title="{{ trans('general.accessories') }}">
<i class="far fa-keyboard fa-fw" style="font-size: 17px" aria-hidden="true"></i>
- {!! ($location->accessories->count() > 0) ? '<span class="badge">'.number_format($location->accessories->count()).'</span>' : '' !!}
+ {!! ($location->accessories()->count() > 0) ? '<span class="badge">'.number_format($location->accessories()->count()).'</span>' : '' !!}
<span class="sr-only">
{{ trans('general.accessories') }}
</span>
@@ -93,7 +93,7 @@
<li>
<a href="#accessories_assigned" data-toggle="tab" data-tooltip="true" title="{{ trans('general.accessories_assigned') }}">
<i class="fas fa-keyboard fa-fw" style="font-size: 17px" aria-hidden="true"></i>
- {!! ($location->assignedAccessories->count() > 0) ? '<span class="badge">'.number_format($location->assignedAccessories->count()).'</span>' : '' !!}
+ {!! ($location->assignedAccessories()->count() > 0) ? '<span class="badge">'.number_format($location->assignedAccessories()->count()).'</span>' : '' !!}
<span class="sr-only">
{{ trans('general.accessories_assigned') }}
</span>
@@ -106,7 +106,7 @@
<li>
<a href="#consumables" data-toggle="tab" data-tooltip="true" title="{{ trans('general.consumables') }}">
<i class="fas fa-tint fa-fw" style="font-size: 17px" aria-hidden="true"></i>
- {!! ($location->consumables->count() > 0) ? '<span class="badge">'.number_format($location->consumables->count()).'</span>' : '' !!}
+ {!! ($location->consumables()->count() > 0) ? '<span class="badge">'.number_format($location->consumables->count()).'</span>' : '' !!}
<span class="sr-only">
{{ trans('general.consumables') }}
</span>
@@ -118,7 +118,7 @@
<li>
<a href="#components" data-toggle="tab" data-tooltip="true" title="{{ trans('general.components') }}">
<i class="fas fa-hdd fa-fw" style="font-size: 17px" aria-hidden="true"></i>
- {!! ($location->components->count() > 0) ? '<span class="badge">'.number_format($location->components->count()).'</span>' : '' !!}
+ {!! ($location->components->count() > 0) ? '<span class="badge">'.number_format($location->components()->count()).'</span>' : '' !!}
<span class="sr-only">
{{ trans('general.components') }}
</span>
@@ -126,6 +126,18 @@
</li>
@endcan
+ <li>
+ <a href="#child_locations" data-toggle="tab" data-tooltip="true" title="{{ trans('general.child_locations') }}">
+ <span class="hidden-xs hidden-sm">
+ <i class="fa-solid fa-city fa-fw" style="font-size: 17px" aria-hidden="true"></i>
+ <span class="sr-only">
+ {{ trans('general.child_locations') }}
+ </span>
+ {!! ($location->children()->count() > 0 ) ? '<span class="badge">'.number_format($location->children()->count()).'</span>' : '' !!}
+ </span>
+ </a>
+ </li>
+
<li>
<a href="#files" data-toggle="tab" data-tooltip="true" title="{{ trans('general.files') }}">
@@ -137,11 +149,15 @@
<span class="sr-only">
{{ trans('general.files') }}
</span>
- {!! ($location->uploads->count() > 0 ) ? '<span class="badge">'.number_format($location->uploads->count()).'</span>' : '' !!}
+ {!! ($location->uploads()->count() > 0 ) ? '<span class="badge">'.number_format($location->uploads()->count()).'</span>' : '' !!}
</span>
</a>
</li>
+
+
+
+
<li>
<a href="#history" data-toggle="tab" data-tooltip="true" title="{{ trans('general.history') }}">
<i class="fa-solid fa-clock-rotate-left fa-fw" style="font-size: 17px" aria-hidden="true"></i>
@@ -350,15 +366,52 @@
</table>
</div><!-- /.tab-pane -->
- <div class="tab-pane fade" id="files">
+ <div class="tab-pane fade" id="child_locations">
+ <div class="tab-pane" id="child_locations">
+ <h2 class="box-title">
+ {{ trans('general.child_locations') }}
+ </h2>
+ <table
+ role="table"
+ data-columns="{{ \App\Presenters\LocationPresenter::dataTableLayout() }}"
+ data-cookie-id-table="childrenListingTable"
+ data-id-table="childrenListingTable"
+ data-side-pagination="server"
+ data-sort-order="asc"
+ id="childrenListingTable"
+ data-buttons="childrenListingTable"
+ class="table table-striped snipe-table"
+ data-url="{{route('api.locations.index', ['parent_id' => $location->id]) }}"
+ data-export-options='{
+ "fileName": "export-children-locations-{{ str_slug($location->name) }}-{{ date('Y-m-d') }}",
+ "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
+ }'>
+ </table>
+ </div><!-- /.tab-pane -->
+ </div>
- <div class="row">
- <div class="col-md-12">
- <x-filestable object_type="locations" :object="$location" />
- </div> <!-- /.col-md-12 -->
- </div> <!-- /.row -->
+ <div class="tab-pane" id="accessories_assigned">
+ <h2 class="box-title" style="float:left">
+ {{ trans('general.accessories_assigned') }}
+ </h2>
- </div>
+ <table
+ role="table"
+ data-columns="{{ \App\Presenters\LocationPresenter::assignedAccessoriesDataTableLayout() }}"
+ data-cookie-id-table="accessoriesAssignedListingTable"
+ data-id-table="accessoriesAssignedListingTable"
+ data-side-pagination="server"
+ data-sort-order="asc"
+ id="accessoriesAssignedListingTable"
+ data-buttons="accessoryButtons"
+ class="table table-striped snipe-table"
+ data-url="{{ route('api.locations.assigned_accessories', ['location' => $location]) }}"
+ data-export-options='{
+ "fileName": "export-locations-{{ str_slug($location->name) }}-accessories-{{ date('Y-m-d') }}",
+ "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
+ }'>
+ </table>
+ </div><!-- /.tab-pane -->
<div class="tab-pane" id="history">
<h2 class="box-title">{{ trans('general.history') }}</h2>
@@ -424,16 +477,16 @@
<li>{{ $location->city }} {{ $location->state }} {{ $location->zip }}</li>
@endif
@if ($location->manager)
- <li>{{ trans('admin/users/table.manager') }}: {!! $location->manager->present()->nameUrl() !!}</li>
+ <li><strong>{{ trans('admin/users/table.manager') }}</strong>: {!! $location->manager->present()->nameUrl() !!}</li>
@endif
@if ($location->company)
- <li>{{ trans('admin/companies/table.name') }}: {!! $location->company->present()->nameUrl() !!}</li>
+ <li><strong>{{ trans('admin/companies/table.name') }}</strong>: {!! $location->company->present()->nameUrl() !!}</li>
@endif
@if ($location->parent)
- <li>{{ trans('admin/locations/table.parent') }}: {!! $location->parent->present()->nameUrl() !!}</li>
+ <li><strong>{{ trans('admin/locations/table.parent') }}</strong>: {!! $location->parent->present()->nameUrl() !!}</li>
@endif
@if ($location->ldap_ou)
- <li>{{ trans('admin/locations/table.ldap_ou') }}: {{ $location->ldap_ou }}</li>
+ <li><strong>{{ trans('admin/locations/table.ldap_ou') }}</strong>: {{ $location->ldap_ou }}</li>
@endif
@@ -476,7 +529,7 @@
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('locations.print_assigned', ['locationId' => $location->id]) }}" style="width: 100%;" class="btn btn-sm btn-primary btn-social hidden-print">
<x-icon type="print" />
- {{ trans('admin/locations/table.print_assigned') }}
+ {{ trans('admin/locations/table.print_inventory') }}
</a>
</div>
<div class="col-md-12" style="padding-top: 5px;">