From 0ef1dfe061be085a47270767769d162ad31a9f06 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 31 Mar 2020 18:39:58 -0700 Subject: [PATCH] Switched from layout tables to decorated divs for asset detail page --- resources/views/hardware/view.blade.php | 884 ++++++++++++++---------- 1 file changed, 522 insertions(+), 362 deletions(-) diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index a397044bc4..e9899e4a66 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -104,14 +104,18 @@
-
- - - @if ($asset->assetstatus) - - - - - @endif + + + @endif - @if ($asset->company) - - - - - @endif + @if ($asset->company) +
+
+ {{ trans('general.company') }} +
+ +
+ @endif - @if ($asset->name) - - - - - @endif + @if ($asset->name) +
+
+ {{ trans('admin/hardware/form.name') }} +
+
+ {{ $asset->name }} +
+
+ @endif - @if ($asset->serial) - - - - - @endif - @if ((isset($audit_log)) && ($audit_log->created_at)) - - - - - @endif - @if ($asset->next_audit_date) - - - - - @endif + @if ($asset->serial) +
+
+ {{ trans('admin/hardware/form.serial') }} +
+
+ {{ $asset->serial }} +
+
+ @endif - @if (($asset->model) && ($asset->model->manufacturer)) - - - - - @endif - - - - - + @if (($asset->model) && ($asset->model->manufacturer->support_url)) +
  • + + + {{ $asset->model->manufacturer->support_url }} + +
  • + @endif - - - - - + + + + @endif + + @if ($asset->expected_checkin!='') +
    +
    + + {{ trans('admin/hardware/form.expected_checkin') }} + +
    +
    + {{ \App\Helpers\Helper::getFormattedDateObject($asset->expected_checkin, 'date', false) }} +
    +
    + @endif + +
    +
    + + {{ trans('admin/hardware/form.notes') }} + +
    +
    + {!! nl2br(e($asset->notes)) !!} +
    +
    + + @if ($asset->location) +
    +
    + + {{ trans('general.location') }} + +
    +
    + @can('superuser') + + {{ $asset->location->name }} + + @else + {{ $asset->location->name }} + @endcan +
    +
    + @endif + + @if ($asset->defaultLoc) +
    +
    + + {{ trans('admin/hardware/form.default_location') }} + +
    +
    + @can('superuser') + + {{ $asset->defaultLoc->name }} + + @else + {{ $asset->defaultLoc->name }} + @endcan +
    +
    + @endif + + @if ($asset->created_at!='') +
    +
    + + {{ trans('general.created_at') }} + +
    +
    + {{ \App\Helpers\Helper::getFormattedDateObject($asset->created_at, 'datetime', false) }} +
    +
    + @endif + + @if ($asset->updated_at!='') +
    +
    + + {{ trans('general.updated_at') }} + +
    +
    + {{ \App\Helpers\Helper::getFormattedDateObject($asset->updated_at, 'datetime', false) }} +
    +
    + @endif - - - - +
    +
    + + {{ trans('general.checkouts_count') }} + +
    +
    + {{ ($asset->checkouts) ? (int) $asset->checkouts->count() : '0' }} +
    +
    - @if (($asset->model) && ($asset->model->fieldset)) - @foreach($asset->model->fieldset->fields as $field) - - - - - @endforeach - @endif - - @if ($asset->purchase_date) - - - - - @endif - - @if ($asset->purchase_cost) - - - - - @endif - @if ($asset->order_number) - - - - - @endif +
    +
    + + {{ trans('general.user_requests_count') }} + +
    +
    + {{ ($asset->userRequests) ? (int) $asset->userRequests->count() : '0' }} +
    +
    - @if ($asset->supplier) - - - - - @endif + - @if ($asset->warranty_months) - present()->warrantee_expires() < date("Y-m-d") ? ' class="warning"' : '' !!}> - - - - @endif - - @if (($asset->model) && ($asset->depreciation)) - - - - - - - - - @endif - - @if (($asset->model) && ($asset->model->eol)) - - - - - @endif - - - - @if ($asset->expected_checkin!='') - - - - - @endif - - - - - - - @if ($asset->location) - - - - - @endif - - @if ($asset->defaultLoc) - - - - - @endif - - @if ($asset->created_at!='') - - - - - @endif - - @if ($asset->updated_at!='') - - - - - @endif - - - - - - - - - - - - - - - - - -
    {{ trans('general.status') }} + + +
    + + @if ($asset->assetstatus) + +
    +
    + {{ trans('general.status') }} +
    +
    @if (($asset->assignedTo) && ($asset->deleted_at=='')) {{ $asset->assetstatus->name }} @@ -124,391 +128,535 @@ @if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1')) @elseif (($asset->assetstatus) && ($asset->assetstatus->pending=='1')) - + @elseif (($asset->assetstatus) && ($asset->assetstatus->archived=='1')) @endif - - {{ $asset->assetstatus->name }} - + + {{ $asset->assetstatus->name }} + @endif -
    {{ trans('general.company') }}{{ $asset->company->name }}
    {{ trans('admin/hardware/form.name') }}{{ $asset->name }}
    {{ trans('admin/hardware/form.serial') }}{{ $asset->serial }}
    {{ trans('general.last_audit') }} {{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }} (by {{ link_to_route('users.show', $audit_log->user->present()->fullname(), [$audit_log->user->id]) }})
    {{ trans('general.next_audit_date') }} {{ \App\Helpers\Helper::getFormattedDateObject($asset->next_audit_date, 'date', false) }}
    {{ trans('admin/hardware/form.manufacturer') }} -
      + + @if ((isset($audit_log)) && ($audit_log->created_at)) +
      +
      + + {{ trans('general.last_audit') }} + +
      +
      + {{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }} (by {{ link_to_route('users.show', $audit_log->user->present()->fullname(), [$audit_log->user->id]) }}) +
      +
      + @endif + + @if ($asset->next_audit_date) +
      +
      + + {{ trans('general.next_audit_date') }} + +
      +
      + {{ \App\Helpers\Helper::getFormattedDateObject($asset->next_audit_date, 'date', false) }} +
      +
      + @endif + + @if (($asset->model) && ($asset->model->manufacturer)) +
      +
      + + {{ trans('admin/hardware/form.manufacturer') }} + +
      +
      + -
    - {{ trans('general.category') }} - @if (($asset->model) && ($asset->model->category)) - - @can('view', \App\Models\Category::class) - - - {{ $asset->model->category->name }} + @if (($asset->model) && ($asset->model->manufacturer->url)) +
  • + + + {{ $asset->model->manufacturer->url }} - @else - {{ $asset->model->category->name }} - @endcan - @else - Invalid category +
  • @endif -
    + @if (($asset->model) && ($asset->model->manufacturer->support_phone)) +
  • + + + {{ $asset->model->manufacturer->support_phone }} + +
  • + @endif + + @if (($asset->model) && ($asset->model->manufacturer->support_email)) +
  • + + {{ $asset->model->manufacturer->support_email }} + +
  • + @endif + + + + @endif + +
    +
    + + {{ trans('general.category') }} + +
    +
    + @if (($asset->model) && ($asset->model->category)) + + @can('view', \App\Models\Category::class) + + + {{ $asset->model->category->name }} + + @else + {{ $asset->model->category->name }} + @endcan + @else + Invalid category + @endif +
    +
    + + @if ($asset->model) +
    +
    + {{ trans('admin/hardware/form.model') }} -
    - + + +
    @if ($asset->model) - @can('view', \App\Models\AssetModel::class) - - {{ $asset->model->name }} - - @else + @can('view', \App\Models\AssetModel::class) + {{ $asset->model->name }} - @endcan + + @else + {{ $asset->model->name }} + @endcan + + @endif +
    + + @endif + +
    +
    + + {{ trans('admin/models/table.modelnumber') }} + +
    +
    + {{ ($asset->model) ? $asset->model->model_number : ''}} +
    +
    + + @if (($asset->model) && ($asset->model->fieldset)) + @foreach($asset->model->fieldset->fields as $field) +
    +
    + + {{ $field->name }} + +
    +
    + @if ($field->field_encrypted=='1') + + @endif + + @if ($field->isFieldDecryptable($asset->{$field->db_column_name()} )) + @can('superuser') + @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) + {{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} + @else + {{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} + @endif + @else + {{ strtoupper(trans('admin/custom_fields/general.encrypted')) }} + @endcan + + @else + @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) + {{ $asset->{$field->db_column_name()} }} + @else + {!! nl2br(e($asset->{$field->db_column_name()})) !!} + @endif + @endif +
    +
    + @endforeach + @endif + + + @if ($asset->purchase_date) +
    +
    + + {{ trans('admin/hardware/form.date') }} + +
    +
    + {{ \App\Helpers\Helper::getFormattedDateObject($asset->purchase_date, 'date', false) }} +
    +
    + @endif + + @if ($asset->purchase_cost) +
    +
    + + {{ trans('admin/hardware/form.cost') }} + +
    +
    + @if (($asset->id) && ($asset->location)) + {{ $asset->location->currency }} + @elseif (($asset->id) && ($asset->location)) + {{ $asset->location->currency }} + @else + {{ $snipeSettings->default_currency }} + @endif + {{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost)}} + +
    +
    + @endif + + @if ($asset->order_number) +
    +
    + + {{ trans('general.order_number') }} + +
    +
    + #{{ $asset->order_number }} +
    +
    + @endif + + @if ($asset->supplier) +
    +
    + + {{ trans('general.supplier') }} + +
    +
    + @can ('superuser') + + {{ $asset->supplier->name }} + + @else + {{ $asset->supplier->name }} + @endcan +
    +
    + @endif + + + @if ($asset->warranty_months) +
    +
    + + {{ trans('admin/hardware/form.warranty') }} + +
    +
    + {{ $asset->warranty_months }} + {{ trans('admin/hardware/form.months') }} + + ({{ trans('admin/hardware/form.expires') }} + {{ $asset->present()->warrantee_expires() }}) +
    +
    + @endif + + @if (($asset->model) && ($asset->depreciation)) +
    +
    + + {{ trans('general.depreciation') }} + +
    +
    + {{ $asset->depreciation->name }} + ({{ $asset->depreciation->months }} + {{ trans('admin/hardware/form.months') }} + ) +
    +
    +
    +
    + + {{ trans('admin/hardware/form.fully_depreciated') }} + +
    +
    + @if ($asset->time_until_depreciated()->y > 0) + {{ $asset->time_until_depreciated()->y }} + {{ trans('admin/hardware/form.years') }}, + @endif + {{ $asset->time_until_depreciated()->m }} + {{ trans('admin/hardware/form.months') }} + ({{ $asset->depreciated_date()->format('Y-m-d') }}) +
    +
    + @endif + + @if (($asset->model) && ($asset->model->eol)) +
    +
    + + {{ trans('admin/hardware/form.eol_rate') }} + +
    +
    + {{ $asset->model->eol }} + {{ trans('admin/hardware/form.months') }} + +
    +
    + +
    +
    + + {{ trans('admin/hardware/form.eol_date') }} + +
    +
    + {{ $asset->present()->eol_date() }} + + + @if ($asset->present()->months_until_eol()) + - + @if ($asset->present()->months_until_eol()->y > 0) + {{ $asset->present()->months_until_eol()->y }} + {{ trans('general.years') }}, + @endif + + {{ $asset->present()->months_until_eol()->m }} + {{ trans('general.months') }} @endif -
    {{ trans('admin/models/table.modelnumber') }} - {{ ($asset->model) ? $asset->model->model_number : ''}} -
    - {{ $field->name }} - - @if ($field->field_encrypted=='1') - - @endif - - @if ($field->isFieldDecryptable($asset->{$field->db_column_name()} )) - @can('superuser') - @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) - {{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} - @else - {{ \App\Helpers\Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} - @endif - @else - {{ strtoupper(trans('admin/custom_fields/general.encrypted')) }} - @endcan - - @else - @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) - {{ $asset->{$field->db_column_name()} }} - @else - {!! nl2br(e($asset->{$field->db_column_name()})) !!} - @endif - @endif -
    {{ trans('admin/hardware/form.date') }} - {{ \App\Helpers\Helper::getFormattedDateObject($asset->purchase_date, 'date', false) }} -
    {{ trans('admin/hardware/form.cost') }} - @if (($asset->id) && ($asset->location)) - {{ $asset->location->currency }} - @elseif (($asset->id) && ($asset->location)) - {{ $asset->location->currency }} - @else - {{ $snipeSettings->default_currency }} - @endif - {{ \App\Helpers\Helper::formatCurrencyOutput($asset->purchase_cost)}} +
    +
    + + {{ trans('general.checkins_count') }} + +
    +
    + {{ ($asset->checkins) ? (int) $asset->checkins->count() : '0' }} +
    +
    -
    {{ trans('general.order_number') }} - #{{ $asset->order_number }} -
    {{ trans('general.supplier') }} - @can ('superuser') - - {{ $asset->supplier->name }} - - @else - {{ $asset->supplier->name }} - @endcan -
    {{ trans('admin/hardware/form.warranty') }} - {{ $asset->warranty_months }} - {{ trans('admin/hardware/form.months') }} - - ({{ trans('admin/hardware/form.expires') }} - {{ $asset->present()->warrantee_expires() }}) -
    {{ trans('general.depreciation') }} - {{ $asset->depreciation->name }} - ({{ $asset->depreciation->months }} - {{ trans('admin/hardware/form.months') }} - ) -
    - {{ trans('admin/hardware/form.fully_depreciated') }} - - @if ($asset->time_until_depreciated()->y > 0) - {{ $asset->time_until_depreciated()->y }} - {{ trans('admin/hardware/form.years') }}, - @endif - {{ $asset->time_until_depreciated()->m }} - {{ trans('admin/hardware/form.months') }} - ({{ $asset->depreciated_date()->format('Y-m-d') }}) -
    {{ trans('admin/hardware/form.eol_rate') }} - {{ $asset->model->eol }} - {{ trans('admin/hardware/form.months') }} - - ( - {{ trans('admin/hardware/form.eol_date') }}: - {{ $asset->present()->eol_date() }} - @if ($asset->present()->months_until_eol()) - ( - @if ($asset->present()->months_until_eol()->y > 0) {{ $asset->present()->months_until_eol()->y }} - {{ trans('general.years') }}, - @endif - - {{ $asset->present()->months_until_eol()->m }} - {{ trans('general.months') }} - ) - @endif - -
    {{ trans('admin/hardware/form.expected_checkin') }} - {{ \App\Helpers\Helper::getFormattedDateObject($asset->expected_checkin, 'date', false) }} -
    {{ trans('admin/hardware/form.notes') }} {!! nl2br(e($asset->notes)) !!}
    {{ trans('general.location') }} - @can('superuser') - - {{ $asset->location->name }} - - @else - {{ $asset->location->name }} - @endcan -
    {{ trans('admin/hardware/form.default_location') }} - @can('superuser') - - {{ $asset->defaultLoc->name }} - - @else - {{ $asset->defaultLoc->name }} - @endcan -
    {{ trans('general.created_at') }} - {{ \App\Helpers\Helper::getFormattedDateObject($asset->created_at, 'datetime', false) }} -
    {{ trans('general.updated_at') }} - {{ \App\Helpers\Helper::getFormattedDateObject($asset->updated_at, 'datetime', false) }} -
    {{ trans('general.checkouts_count') }} - {{ ($asset->checkouts) ? (int) $asset->checkouts->count() : '0' }} -
    {{ trans('general.checkins_count') }} - {{ ($asset->checkins) ? (int) $asset->checkins->count() : '0' }} -
    {{ trans('general.user_requests_count') }} - {{ ($asset->userRequests) ? (int) $asset->userRequests->count() : '0' }} -
    -
    @if ($asset->image)
    - + + {{ $asset->getDisplayNameAttribute() }} +
    @elseif (($asset->model) && ($asset->model->image!=''))
    - + + {{ $asset->getDisplayNameAttribute() }} +
    @endif @if ($snipeSettings->qr_code=='1') - + QR code for {{ $asset->getDisplayNameAttribute() }} @endif @if (($asset->assignedTo) && ($asset->deleted_at=='')) @@ -522,12 +670,15 @@
      @if ((isset($asset->assignedTo->email)) && ($asset->assignedTo->email!='')) -
    • {{ $asset->assignedTo->email }}
    • +
    • + + {{ $asset->assignedTo->email }} +
    • @endif @if ((isset($asset->assignedTo)) && ($asset->assignedTo->phone!=''))
    • - + {{ $asset->assignedTo->phone }}
    • @endif @@ -658,7 +809,8 @@ 'class' => 'form-inline', 'id' => 'bulkForm']) }}
      - @@ -756,7 +908,7 @@ data-cookie-id-table="assetHistory"> - + Icon {{ trans('general.date') }} {{ trans('general.admin') }} {{ trans('general.action') }} @@ -779,6 +931,8 @@
      + + @if ($asset->uploads->count() > 0) - + @@ -808,10 +962,10 @@ - @if ($asset->uploads->count() > 0) + @foreach ($asset->uploads as $file) - + @@ -847,15 +1003,19 @@ @endforeach - @else - - - - @endif
      Icon {{ trans('general.notes') }} {{ trans('general.image') }} {{ trans('general.file_name') }}
      @if ($file->note) {{ $file->note }} @@ -829,7 +983,9 @@ @if ($file->filename) - + + + @endif
      - {{ trans('general.no_results') }} -
      + + @else + +
      +
      + + {{ trans('general.no_results') }} +
      +
      + @endif +