mirror of
https://github.com/grokability/snipe-it.git
synced 2026-03-12 17:52:00 +08:00
More info anel refinements
This commit is contained in:
@@ -389,7 +389,7 @@ class License extends Depreciable
|
||||
*/
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Category::class, 'category_id');
|
||||
return $this->belongsTo(\App\Models\Category::class, 'category_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,7 +401,7 @@ class License extends Depreciable
|
||||
*/
|
||||
public function manufacturer()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Manufacturer::class, 'manufacturer_id');
|
||||
return $this->belongsTo(\App\Models\Manufacturer::class, 'manufacturer_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -304,10 +304,10 @@ class AssetModelPresenter extends Presenter
|
||||
|
||||
public function formattedNameLink() {
|
||||
|
||||
if (auth()->user()->can('models.view', $this)) {
|
||||
return '<a href="'.route('models.show', e($this->id)).'">'.e($this->name).'</a>';
|
||||
if (auth()->user()->can('view', ['\App\Models\AssetModel', $this])) {
|
||||
return '<a href="'.route('models.show', e($this->id)).'" class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</a>';
|
||||
}
|
||||
|
||||
return $this->name;
|
||||
return '<span class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,10 +157,16 @@ class CategoryPresenter extends Presenter
|
||||
|
||||
public function formattedNameLink() {
|
||||
|
||||
if (auth()->user()->can('view', ['\App\Models\Category', $this])) {
|
||||
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('categories.show', e($this->id)).'">'.e($this->name).'</a>';
|
||||
// We use soft-deletes for categories, but we don't give you a way to restore them right now. This would be the method we'd use when that happens
|
||||
// if (auth()->user()->can('view', ['\App\Models\Category', $this])) {
|
||||
// return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('models.show', e($this->id)).'" class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</a>';
|
||||
// }
|
||||
|
||||
if ((auth()->user()->can('view', ['\App\Models\Category', $this])) && ($this->deleted_at=='')) {
|
||||
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<a href="'.route('categories.show', e($this->id)).'">'.e($this->name).'</a>';
|
||||
}
|
||||
|
||||
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').e($this->name);
|
||||
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i>" : '').'<span class="'. (($this->deleted_at!='') ? 'deleted' : '').'">'.e($this->display_name).'</span>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
@endif
|
||||
|
||||
@if ($infoPanelObj->termination_date)
|
||||
<x-info-element icon_type="terminates" title="{{ trans('general.termination_date') }}">
|
||||
<x-info-element icon_type="terminates" title="{{ trans('admin/licenses/form.termination_date') }}">
|
||||
{{ Helper::getFormattedDateObject($infoPanelObj->termination_date, 'date', false) }}
|
||||
</x-info-element>
|
||||
@endif
|
||||
@@ -130,7 +130,9 @@
|
||||
{{ $snipeSettings->default_currency }}
|
||||
@endif
|
||||
|
||||
{{ Helper::formatCurrencyOutput($infoPanelObj->purchase_cost) }}
|
||||
<x-copy-to-clipboard copy_what="purchase_cost" class="pull-right">
|
||||
{{ Helper::formatCurrencyOutput($infoPanelObj->purchase_cost) }}
|
||||
</x-copy-to-clipboard>
|
||||
</x-info-element>
|
||||
|
||||
@if (isset($infoPanelObj->qty))
|
||||
@@ -175,7 +177,7 @@
|
||||
|
||||
@if ($infoPanelObj->category)
|
||||
<x-info-element icon_type="category" icon_color="{{ $infoPanelObj->category->tag_color }}" title="{{ trans('general.category') }}">
|
||||
{!! $infoPanelObj->category->present()->nameUrl !!}
|
||||
{!! $infoPanelObj->category->present()->formattedNameLink !!}
|
||||
</x-info-element>
|
||||
@endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user