Skip to content

A free open source IT asset/license management system

Extract parent layout

Marcus Moore8364d26c9be3
diff --git a/resources/views/users/print-shell.blade.php b/resources/views/users/print-shell.blade.php
new file mode 100644
index 0000000000..0ea843c8ae
--- /dev/null
+++ b/resources/views/users/print-shell.blade.php
@@ -0,0 +1,163 @@
+<!doctype html>
+<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>{{ trans('general.assigned_to', ['name' => $show_user->present()->fullName()]) }} - {{ date('Y-m-d H:i', time()) }}</title>
+
+ <link rel="shortcut icon" type="image/ico" href="{{ ($snipeSettings) && ($snipeSettings->favicon!='') ? Storage::disk('public')->url(e($snipeSettings->favicon)) : config('app.url').'/favicon.ico' }}">
+
+ <link rel="stylesheet" href="{{ url(mix('css/dist/bootstrap-table.css')) }}">
+
+ {{-- stylesheets --}}
+ <link rel="stylesheet" href="{{ url(mix('css/dist/all.css')) }}">
+
+ <script nonce="{{ csrf_token() }}">
+ window.snipeit = {
+ settings: {
+ "per_page": 50
+ }
+ };
+ </script>
+
+ <style>
+ body {
+ font-family: "Arial, Helvetica", sans-serif;
+ padding: 20px;
+ }
+ table.inventory {
+ width: 100%;
+ border: 1px solid #d3d3d3;
+ }
+
+ @page {
+ size: A4;
+ }
+
+ .print-logo {
+ max-height: 40px;
+ }
+
+ h4 {
+ margin-top: 20px;
+ margin-bottom: 10px;
+ }
+ </style>
+
+ <script nonce="{{ csrf_token() }}">
+ window.snipeit = {
+ settings: {
+ "per_page": 50
+ }
+ };
+ </script>
+
+</head>
+<body>
+
+@if ($snipeSettings->logo_print_assets=='1')
+ @if ($snipeSettings->brand == '3')
+
+ <h2>
+ @if ($snipeSettings->logo!='')
+ <img class="print-logo" src="{{ config('app.url') }}/uploads/{{ $snipeSettings->logo }}">
+ @endif
+ {{ $snipeSettings->site_name }}
+ </h2>
+ @elseif ($snipeSettings->brand == '2')
+ @if ($snipeSettings->logo!='')
+ <img class="print-logo" src="{{ config('app.url') }}/uploads/{{ $snipeSettings->logo }}">
+ @endif
+ @else
+ <h2>{{ $snipeSettings->site_name }}</h2>
+ @endif
+@endif
+
+@yield('content')
+
+{{-- Javascript files --}}
+<script src="{{ url(mix('js/dist/all.js')) }}" nonce="{{ csrf_token() }}"></script>
+
+<script src="{{ url(mix('js/dist/bootstrap-table.js')) }}"></script>
+<script src="{{ url(mix('js/dist/bootstrap-table-locale-all.min.js')) }}"></script>
+
+<!-- load english again here, even though it's in the all.js file, because if BS table doesn't have the translation, it otherwise defaults to chinese. See https://bootstrap-table.com/docs/api/table-options/#locale -->
+<script src="{{ url(mix('js/dist/bootstrap-table-en-US.min.js')) }}"></script>
+
+<script>
+ $('.snipe-table').bootstrapTable('destroy').each(function () {
+ console.log('BS table loaded');
+
+ data_export_options = $(this).attr('data-export-options');
+ export_options = data_export_options ? JSON.parse(data_export_options) : {};
+ export_options['htmlContent'] = false; // this is already the default; but let's be explicit about it
+ export_options['jspdf']= {"orientation": "l"};
+ // the following callback method is necessary to prevent XSS vulnerabilities
+ // (this is taken from Bootstrap Tables's default wrapper around jQuery Table Export)
+ export_options['onCellHtmlData'] = function (cell, rowIndex, colIndex, htmlData) {
+ if (cell.is('th')) {
+ return cell.find('.th-inner').text()
+ }
+ return htmlData
+ }
+ $(this).bootstrapTable({
+ classes: 'table table-responsive table-no-bordered',
+ ajaxOptions: {
+ headers: {
+ 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
+ }
+ },
+ // reorderableColumns: true,
+ stickyHeader: true,
+ stickyHeaderOffsetLeft: parseInt($('body').css('padding-left'), 10),
+ stickyHeaderOffsetRight: parseInt($('body').css('padding-right'), 10),
+ undefinedText: '',
+ iconsPrefix: 'fa',
+ cookieStorage: '{{ config('session.bs_table_storage') }}',
+ cookie: true,
+ cookieExpire: '2y',
+ mobileResponsive: true,
+ maintainSelected: true,
+ trimOnSearch: false,
+ showSearchClearButton: true,
+ paginationFirstText: "{{ trans('general.first') }}",
+ paginationLastText: "{{ trans('general.last') }}",
+ paginationPreText: "{{ trans('general.previous') }}",
+ paginationNextText: "{{ trans('general.next') }}",
+ pageList: ['10','20', '30','50','100','150','200'{!! ((config('app.max_results') > 200) ? ",'500'" : '') !!}{!! ((config('app.max_results') > 500) ? ",'".config('app.max_results')."'" : '') !!}],
+ pageSize: {{ (($snipeSettings->per_page!='') && ($snipeSettings->per_page > 0)) ? $snipeSettings->per_page : 20 }},
+ paginationVAlign: 'both',
+ queryParams: function (params) {
+ var newParams = {};
+ for(var i in params) {
+ if(!keyBlocked(i)) { // only send the field if it's not in blockedFields
+ newParams[i] = params[i];
+ }
+ }
+ return newParams;
+ },
+ formatLoadingMessage: function () {
+ return '<h2><i class="fas fa-spinner fa-spin" aria-hidden="true"></i> {{ trans('general.loading') }} </h4>';
+ },
+ icons: {
+ advancedSearchIcon: 'fas fa-search-plus',
+ paginationSwitchDown: 'fa-caret-square-o-down',
+ paginationSwitchUp: 'fa-caret-square-o-up',
+ fullscreen: 'fa-expand',
+ columns: 'fa-columns',
+ refresh: 'fas fa-sync-alt',
+ export: 'fa-download',
+ clearSearch: 'fa-times'
+ },
+ exportOptions: export_options,
+
+ exportTypes: ['xlsx', 'excel', 'csv', 'pdf','json', 'xml', 'txt', 'sql', 'doc' ],
+ onLoadSuccess: function () {
+ $('[data-tooltip="true"]').tooltip(); // Needed to attach tooltips after ajax call
+ }
+
+ });
+ });
+</script>
+
+</body>
+</html>
diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php
index d4a8cebf1a..822d15d883 100644
--- a/resources/views/users/print.blade.php
+++ b/resources/views/users/print.blade.php
@@ -1,83 +1,13 @@
-<!doctype html>
-<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <title>{{ trans('general.assigned_to', ['name' => $show_user->present()->fullName()]) }} - {{ date('Y-m-d H:i', time()) }}</title>
+@extends('users.print-shell')
- <link rel="shortcut icon" type="image/ico" href="{{ ($snipeSettings) && ($snipeSettings->favicon!='') ? Storage::disk('public')->url(e($snipeSettings->favicon)) : config('app.url').'/favicon.ico' }}">
+@section('content')
- <link rel="stylesheet" href="{{ url(mix('css/dist/bootstrap-table.css')) }}">
-
- {{-- stylesheets --}}
- <link rel="stylesheet" href="{{ url(mix('css/dist/all.css')) }}">
-
- <script nonce="{{ csrf_token() }}">
- window.snipeit = {
- settings: {
- "per_page": 50
- }
- };
- </script>
-
- <style>
- body {
- font-family: "Arial, Helvetica", sans-serif;
- padding: 20px;
- }
- table.inventory {
- width: 100%;
- border: 1px solid #d3d3d3;
- }
-
- @page {
- size: A4;
- }
-
- .print-logo {
- max-height: 40px;
- }
-
- h4 {
- margin-top: 20px;
- margin-bottom: 10px;
- }
- </style>
-
- <script nonce="{{ csrf_token() }}">
- window.snipeit = {
- settings: {
- "per_page": 50
- }
- };
- </script>
-
-</head>
-<body>
-
-@if ($snipeSettings->logo_print_assets=='1')
- @if ($snipeSettings->brand == '3')
-
- <h2>
- @if ($snipeSettings->logo!='')
- <img class="print-logo" src="{{ config('app.url') }}/uploads/{{ $snipeSettings->logo }}">
- @endif
- {{ $snipeSettings->site_name }}
- </h2>
- @elseif ($snipeSettings->brand == '2')
- @if ($snipeSettings->logo!='')
- <img class="print-logo" src="{{ config('app.url') }}/uploads/{{ $snipeSettings->logo }}">
- @endif
- @else
- <h2>{{ $snipeSettings->site_name }}</h2>
- @endif
-@endif
-
-<h3>
- {{ trans('general.assigned_to', ['name' => $show_user->present()->fullName()]) }}
- {{ ($show_user->employee_num!='') ? ' (#'.$show_user->employee_num.') ' : '' }}
- {{ ($show_user->jobtitle!='' ? ' - '.$show_user->jobtitle : '') }}
-</h3>
-<p></p>{{ trans('admin/users/general.all_assigned_list_generation')}} {{ Helper::getFormattedDateObject(now(), 'datetime', false) }}
+ <h3>
+ {{ trans('general.assigned_to', ['name' => $show_user->present()->fullName()]) }}
+ {{ ($show_user->employee_num!='') ? ' (#'.$show_user->employee_num.') ' : '' }}
+ {{ ($show_user->jobtitle!='' ? ' - '.$show_user->jobtitle : '') }}
+ </h3>
+ <p></p>{{ trans('admin/users/general.all_assigned_list_generation')}} {{ Helper::getFormattedDateObject(now(), 'datetime', false) }}
@if ($show_user->assets->count() > 0)
@php
@@ -90,31 +20,31 @@
</div>
<table
- class="snipe-table table table-striped inventory"
- id="AssetsAssigned"
- data-pagination="false"
- data-id-table="AssetsAssigned"
- data-search="false"
- data-side-pagination="client"
- data-sortable="true"
- data-toolbar="#assets-toolbar"
- data-show-columns="true"
- data-sort-order="desc"
- data-sort-name="created_at"
- data-show-columns-toggle-all="true"
- data-cookie-id-table="AssetsAssigned">
+ class="snipe-table table table-striped inventory"
+ id="AssetsAssigned"
+ data-pagination="false"
+ data-id-table="AssetsAssigned"
+ data-search="false"
+ data-side-pagination="client"
+ data-sortable="true"
+ data-toolbar="#assets-toolbar"
+ data-show-columns="true"
+ data-sort-order="desc"
+ data-sort-name="created_at"
+ data-show-columns-toggle-all="true"
+ data-cookie-id-table="AssetsAssigned">
<thead>
- <th data-field="asset_id" data-sortable="false" data-visible="true" data-switchable="false">#</th>
- <th data-field="asset_image" data-sortable="true" data-visible="false" data-switchable="true">{{ trans('general.image') }}</th>
- <th data-field="asset_tag" data-sortable="true" data-visible="true" data-switchable="false">{{ trans('admin/hardware/table.asset_tag') }}</th>
- <th data-field="asset_name" data-sortable="true" data-visible="true">{{ trans('general.name') }}</th>
- <th data-field="asset_category" data-sortable="true" data-visible="true">{{ trans('general.category') }}</th>
- <th data-field="asset_model" data-sortable="true" data-visible="true">{{ trans('admin/hardware/form.model') }}</th>
- <th data-field="rtd_location" data-sortable="true" data-visible="true">{{ trans('admin/hardware/form.default_location') }}</th>
- <th data-field="asset_location" data-sortable="true" data-visible="false">{{ trans('general.location') }}</th>
- <th data-field="asset_serial" data-sortable="true" data-visible="true">{{ trans('admin/hardware/form.serial') }}</th>
- <th data-field="asset_checkout_date" data-sortable="true" data-visible="true">{{ trans('admin/hardware/table.checkout_date') }}</th>
- <th data-field="signature" data-sortable="true" data-visible="true">{{ trans('general.signature') }}</th>
+ <th data-field="asset_id" data-sortable="false" data-visible="true" data-switchable="false">#</th>
+ <th data-field="asset_image" data-sortable="true" data-visible="false" data-switchable="true">{{ trans('general.image') }}</th>
+ <th data-field="asset_tag" data-sortable="true" data-visible="true" data-switchable="false">{{ trans('admin/hardware/table.asset_tag') }}</th>
+ <th data-field="asset_name" data-sortable="true" data-visible="true">{{ trans('general.name') }}</th>
+ <th data-field="asset_category" data-sortable="true" data-visible="true">{{ trans('general.category') }}</th>
+ <th data-field="asset_model" data-sortable="true" data-visible="true">{{ trans('admin/hardware/form.model') }}</th>
+ <th data-field="rtd_location" data-sortable="true" data-visible="true">{{ trans('admin/hardware/form.default_location') }}</th>
+ <th data-field="asset_location" data-sortable="true" data-visible="false">{{ trans('general.location') }}</th>
+ <th data-field="asset_serial" data-sortable="true" data-visible="true">{{ trans('admin/hardware/form.serial') }}</th>
+ <th data-field="asset_checkout_date" data-sortable="true" data-visible="true">{{ trans('admin/hardware/table.checkout_date') }}</th>
+ <th data-field="signature" data-sortable="true" data-visible="true">{{ trans('general.signature') }}</th>
</thead>
<tbody>
@foreach ($show_user->assets as $asset)
@@ -189,19 +119,19 @@
</div>
<table
- class="snipe-table table table-striped inventory"
- id="licensessAssigned"
- data-toolbar="#licenses-toolbar"
- data-pagination="false"
- data-id-table="licensessAssigned"
- data-search="false"
- data-side-pagination="client"
- data-sortable="true"
- data-show-columns="true"
- data-sort-order="desc"
- data-sort-name="created_at"
- data-show-columns-toggle-all="true"
- data-cookie-id-table="licensessAssigned">
+ class="snipe-table table table-striped inventory"
+ id="licensessAssigned"
+ data-toolbar="#licenses-toolbar"
+ data-pagination="false"
+ data-id-table="licensessAssigned"
+ data-search="false"
+ data-side-pagination="client"
+ data-sortable="true"
+ data-show-columns="true"
+ data-sort-order="desc"
+ data-sort-name="created_at"
+ data-show-columns-toggle-all="true"
+ data-cookie-id-table="licensessAssigned">
<thead>
<tr>
<th style="width: 20px;" data-sortable="false" data-switchable="false">#</th>
@@ -244,19 +174,19 @@
</div>
<table
- class="snipe-table table table-striped inventory"
- id="accessoriesAssigned"
- data-toolbar="#accessories-toolbar"
- data-pagination="false"
- data-id-table="accessoriesAssigned"
- data-search="false"
- data-side-pagination="client"
- data-sortable="true"
- data-show-columns="true"
- data-sort-order="desc"
- data-sort-name="created_at"
- data-show-columns-toggle-all="true"
- data-cookie-id-table="accessoriesAssigned">
+ class="snipe-table table table-striped inventory"
+ id="accessoriesAssigned"
+ data-toolbar="#accessories-toolbar"
+ data-pagination="false"
+ data-id-table="accessoriesAssigned"
+ data-search="false"
+ data-side-pagination="client"
+ data-sortable="true"
+ data-show-columns="true"
+ data-sort-order="desc"
+ data-sort-name="created_at"
+ data-show-columns-toggle-all="true"
+ data-cookie-id-table="accessoriesAssigned">
<thead>
<tr>
<th style="width: 20px;" data-sortable="false" data-switchable="false">#</th>
@@ -289,7 +219,7 @@
<td>
@if (($accessory->assetlog->first()) && ($accessory->assetlog->first()->accept_signature!=''))
- <img style="width:auto;height:100px;" src="{{ asset('/') }}display-sig/{{ $accessory->assetlog->first()->accept_signature }}">
+ <img style="width:auto;height:100px;" src="{{ asset('/') }}display-sig/{{ $accessory->assetlog->first()->accept_signature }}">
@endif
</td>
</tr>
@@ -307,19 +237,19 @@
</div>
<table
- class="snipe-table table table-striped inventory"
- id="consumablesAssigned"
- data-pagination="false"
- data-toolbar="#consumables-toolbar"
- data-id-table="consumablesAssigned"
- data-search="false"
- data-side-pagination="client"
- data-sortable="true"
- data-show-columns="true"
- data-sort-order="desc"
- data-sort-name="created_at"
- data-show-columns-toggle-all="true"
- data-cookie-id-table="consumablesAssigned">
+ class="snipe-table table table-striped inventory"
+ id="consumablesAssigned"
+ data-pagination="false"
+ data-toolbar="#consumables-toolbar"
+ data-id-table="consumablesAssigned"
+ data-search="false"
+ data-side-pagination="client"
+ data-sortable="true"
+ data-show-columns="true"
+ data-sort-order="desc"
+ data-sort-name="created_at"
+ data-show-columns-toggle-all="true"
+ data-cookie-id-table="consumablesAssigned">
<thead>
<tr>
<th style="width: 20px;" data-sortable="false" data-switchable="false"></th>
@@ -345,7 +275,7 @@
@if ($consumable->deleted_at!='')
<td>{{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}</td>
@else
- {{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}
+ {{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}
@endif
</td>
<td>{{ ($consumable->category) ? $consumable->category->name : ' invalid/deleted category' }} </td>
@@ -384,7 +314,7 @@
@endforeach
@endif
</td>
- </tr>
+ </tr>
<tr>
<td style="padding-right: 10px; vertical-align: top; font-weight: bold;">{{ trans('general.signed_off_by') }}:</td>
<td style="padding-right: 10px; vertical-align: top;">______________________________________</td>
@@ -413,90 +343,4 @@
</table>
-{{-- Javascript files --}}
-<script src="{{ url(mix('js/dist/all.js')) }}" nonce="{{ csrf_token() }}"></script>
-
-<script src="{{ url(mix('js/dist/bootstrap-table.js')) }}"></script>
-<script src="{{ url(mix('js/dist/bootstrap-table-locale-all.min.js')) }}"></script>
-
-<!-- load english again here, even though it's in the all.js file, because if BS table doesn't have the translation, it otherwise defaults to chinese. See https://bootstrap-table.com/docs/api/table-options/#locale -->
-<script src="{{ url(mix('js/dist/bootstrap-table-en-US.min.js')) }}"></script>
-
-<script>
- $('.snipe-table').bootstrapTable('destroy').each(function () {
- console.log('BS table loaded');
-
- data_export_options = $(this).attr('data-export-options');
- export_options = data_export_options ? JSON.parse(data_export_options) : {};
- export_options['htmlContent'] = false; // this is already the default; but let's be explicit about it
- export_options['jspdf']= {"orientation": "l"};
- // the following callback method is necessary to prevent XSS vulnerabilities
- // (this is taken from Bootstrap Tables's default wrapper around jQuery Table Export)
- export_options['onCellHtmlData'] = function (cell, rowIndex, colIndex, htmlData) {
- if (cell.is('th')) {
- return cell.find('.th-inner').text()
- }
- return htmlData
- }
- $(this).bootstrapTable({
- classes: 'table table-responsive table-no-bordered',
- ajaxOptions: {
- headers: {
- 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
- }
- },
- // reorderableColumns: true,
- stickyHeader: true,
- stickyHeaderOffsetLeft: parseInt($('body').css('padding-left'), 10),
- stickyHeaderOffsetRight: parseInt($('body').css('padding-right'), 10),
- undefinedText: '',
- iconsPrefix: 'fa',
- cookieStorage: '{{ config('session.bs_table_storage') }}',
- cookie: true,
- cookieExpire: '2y',
- mobileResponsive: true,
- maintainSelected: true,
- trimOnSearch: false,
- showSearchClearButton: true,
- paginationFirstText: "{{ trans('general.first') }}",
- paginationLastText: "{{ trans('general.last') }}",
- paginationPreText: "{{ trans('general.previous') }}",
- paginationNextText: "{{ trans('general.next') }}",
- pageList: ['10','20', '30','50','100','150','200'{!! ((config('app.max_results') > 200) ? ",'500'" : '') !!}{!! ((config('app.max_results') > 500) ? ",'".config('app.max_results')."'" : '') !!}],
- pageSize: {{ (($snipeSettings->per_page!='') && ($snipeSettings->per_page > 0)) ? $snipeSettings->per_page : 20 }},
- paginationVAlign: 'both',
- queryParams: function (params) {
- var newParams = {};
- for(var i in params) {
- if(!keyBlocked(i)) { // only send the field if it's not in blockedFields
- newParams[i] = params[i];
- }
- }
- return newParams;
- },
- formatLoadingMessage: function () {
- return '<h2><i class="fas fa-spinner fa-spin" aria-hidden="true"></i> {{ trans('general.loading') }} </h4>';
- },
- icons: {
- advancedSearchIcon: 'fas fa-search-plus',
- paginationSwitchDown: 'fa-caret-square-o-down',
- paginationSwitchUp: 'fa-caret-square-o-up',
- fullscreen: 'fa-expand',
- columns: 'fa-columns',
- refresh: 'fas fa-sync-alt',
- export: 'fa-download',
- clearSearch: 'fa-times'
- },
- exportOptions: export_options,
-
- exportTypes: ['xlsx', 'excel', 'csv', 'pdf','json', 'xml', 'txt', 'sql', 'doc' ],
- onLoadSuccess: function () {
- $('[data-tooltip="true"]').tooltip(); // Needed to attach tooltips after ajax call
- }
-
- });
- });
-</script>
-
-</body>
-</html>
+@endsection