Added more to the views
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use App\Http\Traits\UniqueUndeletedTrait;
|
||||
use App\Models\Traits\CompanyableTrait;
|
||||
use App\Models\Traits\Searchable;
|
||||
use App\Presenters\Presentable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
@@ -22,7 +23,10 @@ class Department extends SnipeModel
|
||||
*/
|
||||
protected $injectUniqueIdentifier = true;
|
||||
|
||||
use ValidatingTrait, UniqueUndeletedTrait;
|
||||
protected $presenter = \App\Presenters\DepartmentPresenter::class;
|
||||
|
||||
|
||||
use ValidatingTrait, UniqueUndeletedTrait, Presentable;
|
||||
|
||||
protected $casts = [
|
||||
'manager_id' => 'integer',
|
||||
|
||||
@@ -154,9 +154,9 @@ class CategoryPresenter extends Presenter
|
||||
public function formattedNameLink() {
|
||||
|
||||
if (auth()->user()->can('category.view', $this)) {
|
||||
return ($this->tag_color ? "<i class='fa-solid 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> " : '').' <a href="'.route('categories.show', e($this->id)).'">'.e($this->name).'</a>';
|
||||
}
|
||||
|
||||
return ($this->tag_color ? "<i class='fa-solid fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i> " : '').$this->name;
|
||||
return ($this->tag_color ? "<i class='fa-solid fa-fw fa-square' style='color: ".e($this->tag_color)."' aria-hidden='true'></i> " : '').$this->name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,4 +175,13 @@ class CompanyPresenter extends Presenter
|
||||
{
|
||||
return route('companies.show', $this->id);
|
||||
}
|
||||
|
||||
public function formattedNameLink() {
|
||||
|
||||
if (auth()->user()->can('company.view', $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('companies.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> " : '').$this->name;
|
||||
}
|
||||
}
|
||||
|
||||
20
app/Presenters/DepartmentPresenter.php
Normal file
20
app/Presenters/DepartmentPresenter.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Presenters;
|
||||
|
||||
/**
|
||||
* Class DepartmentPresenter
|
||||
*/
|
||||
class DepartmentPresenter extends Presenter
|
||||
{
|
||||
|
||||
|
||||
public function formattedNameLink() {
|
||||
|
||||
if (auth()->user()->can('department.view', $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('departments.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> " : '').$this->name;
|
||||
}
|
||||
}
|
||||
@@ -375,4 +375,13 @@ class LocationPresenter extends Presenter
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function formattedNameLink() {
|
||||
|
||||
if (auth()->user()->can('location.view', $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('locations.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> " : '').$this->name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,4 +191,14 @@ class ManufacturerPresenter extends Presenter
|
||||
{
|
||||
return route('manufacturers.show', $this->id);
|
||||
}
|
||||
|
||||
public function formattedNameLink() {
|
||||
|
||||
if (auth()->user()->can('manufacturer.view', $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('manufacturers.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> " : '').$this->name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -237,4 +237,13 @@ class SupplierPresenter extends Presenter
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function formattedNameLink() {
|
||||
|
||||
if (auth()->user()->can('supplier.view', $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('suppliers.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> " : '').$this->name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1592,6 +1592,9 @@ Radio toggle styles for permission settings and check/uncheck all
|
||||
.js-copy-link {
|
||||
color: grey;
|
||||
}
|
||||
.deleted {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
|
||||
/*# sourceMappingURL=app.css.map*/
|
||||
File diff suppressed because one or more lines are too long
@@ -1216,6 +1216,9 @@ Radio toggle styles for permission settings and check/uncheck all
|
||||
.js-copy-link {
|
||||
color: grey;
|
||||
}
|
||||
.deleted {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
|
||||
/*# sourceMappingURL=overrides.css.map*/
|
||||
File diff suppressed because one or more lines are too long
6
public/css/dist/all.css
vendored
6
public/css/dist/all.css
vendored
@@ -22928,6 +22928,9 @@ Radio toggle styles for permission settings and check/uncheck all
|
||||
.js-copy-link {
|
||||
color: grey;
|
||||
}
|
||||
.deleted {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
|
||||
/*# sourceMappingURL=app.css.map*/
|
||||
@@ -24631,6 +24634,9 @@ Radio toggle styles for permission settings and check/uncheck all
|
||||
.js-copy-link {
|
||||
color: grey;
|
||||
}
|
||||
.deleted {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
|
||||
/*# sourceMappingURL=overrides.css.map*/
|
||||
@@ -2,8 +2,8 @@
|
||||
"/js/dist/all.js": "/js/dist/all.js?id=525664c0ec56444ba1c48c125346918a",
|
||||
"/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=68b775c727b842ea7206e45ef7dc6f7a",
|
||||
"/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=be05d91a777b604b23d1133117c55401",
|
||||
"/css/build/overrides.css": "/css/build/overrides.css?id=31f0c9a27245a3b3a37a7d08ba914311",
|
||||
"/css/build/app.css": "/css/build/app.css?id=a1fc9deca6a89a62a0f3cadb2ce5ca6c",
|
||||
"/css/build/overrides.css": "/css/build/overrides.css?id=e453a0eae2a113de9a57d3bf8f5d5787",
|
||||
"/css/build/app.css": "/css/build/app.css?id=b7d72ec1274b9a7c138679b62c220af3",
|
||||
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=ee0ed88465dd878588ed044eefb67723",
|
||||
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=3d8a3d2035ea28aaad4a703c2646f515",
|
||||
"/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=bc6704edc9f0e6a211a8f2e66737f611",
|
||||
@@ -19,7 +19,7 @@
|
||||
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=b2cd9f59d7e8587939ce27b2d3363d82",
|
||||
"/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=a29f618515fa0199a4b4b68fa1d680b3",
|
||||
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=cbd06cc1d58197ccc81d4376bbaf0d28",
|
||||
"/css/dist/all.css": "/css/dist/all.css?id=fc0d990b94339685469761b7ffd7876d",
|
||||
"/css/dist/all.css": "/css/dist/all.css?id=2d808f7209ac9ae88115d7f350150f83",
|
||||
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
|
||||
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
|
||||
"/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde",
|
||||
|
||||
@@ -1364,4 +1364,8 @@ Radio toggle styles for permission settings and check/uncheck all
|
||||
|
||||
.js-copy-link {
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.deleted {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
@@ -166,7 +166,7 @@
|
||||
<strong> {{ trans('general.company')}}</strong>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<a href="{{ route('companies.show', $accessory->company->id) }}">{{ $accessory->company->name }} </a>
|
||||
{!! $accessory->company->present()->formattedNameLink !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -177,7 +177,7 @@
|
||||
<strong>{{ trans('general.location')}}</strong>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<a href="{{ route('locations.show', $accessory->location->id) }}">{{ $accessory->location->name }} </a>
|
||||
{!! $accessory->location->present()->formattedNameLink !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -199,7 +199,7 @@
|
||||
<strong>{{ trans('general.manufacturer')}}</strong>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<a href="{{ route('manufacturers.show', $accessory->manufacturer->id) }}">{{ $accessory->manufacturer->name }} </a>
|
||||
{!! $accessory->manufacturer->present()->formattedNameLink !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
|
||||
@include ('partials.forms.edit.image-upload', ['image_path' => app('departments_upload_path')])
|
||||
|
||||
|
||||
<div class="form-group{!! $errors->has('notes') ? ' has-error' : '' !!}">
|
||||
<label for="notes" class="col-md-3 control-label">{{ trans('general.notes') }}</label>
|
||||
<div class="col-md-8">
|
||||
@@ -41,5 +42,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset name="color-preferences">
|
||||
<x-form-legend help_text="{{ trans('general.tag_color_help') }}">
|
||||
{{ trans('general.tag_color') }}
|
||||
</x-form-legend>
|
||||
<!-- color -->
|
||||
<div class="form-group {{ $errors->has('tag_color') ? 'error' : '' }}">
|
||||
<label for="tag_color" class="col-md-3 control-label">
|
||||
{{ trans('general.tag_color') }}
|
||||
</label>
|
||||
<div class="col-md-9">
|
||||
<x-input.colorpicker :item="$item" id="color" :value="old('color', ($item->color ?? '#f4f4f4'))" name="tag_color" id="tag_color" />
|
||||
{!! $errors->first('tag_color', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
@stop
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<strong>{{ trans('general.company') }}</strong>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<a href="{{ route('companies.show', $license->company->id) }}">{{ $license->company->name }}</a>
|
||||
{!! $license->company->present()->formattedNameLink !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -100,13 +100,7 @@
|
||||
<strong>{{ trans('admin/hardware/form.manufacturer') }}</strong>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
@can('view', \App\Models\Manufacturer::class)
|
||||
<a href="{{ route('manufacturers.show', $license->manufacturer->id) }}">
|
||||
{{ $license->manufacturer->name }}
|
||||
</a>
|
||||
@else
|
||||
{{ $license->manufacturer->name }}
|
||||
@endcan
|
||||
{!! $license->manufacturer->present()->formattedNameLink !!}
|
||||
|
||||
@if ($license->manufacturer->url)
|
||||
<br><x-icon type="globe-us" /> <a href="{{ $license->manufacturer->url }}" rel="noopener">{{ $license->manufacturer->url }}</a>
|
||||
@@ -196,13 +190,7 @@
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
@if ($license->supplier->deleted_at=='')
|
||||
@can('view', \App\Models\Supplier::class)
|
||||
<a href="{{ route('suppliers.show', $license->supplier->id) }}">
|
||||
{{ $license->supplier->name }}
|
||||
</a>
|
||||
@else
|
||||
{{ $license->supplier->name }}
|
||||
@endcan
|
||||
{!! $license->supplier->present()->formattedNameLink !!}
|
||||
|
||||
@if ($license->supplier->url)
|
||||
<br><x-icon type="globe-us" /> <a href="{{ $license->supplier->url }}" rel="noopener">{{ $license->supplier->url }}</a>
|
||||
|
||||
@@ -405,13 +405,7 @@
|
||||
{{ trans('general.company') }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
@can('view', 'App\Models\Company')
|
||||
<a href="{{ route('companies.show', $user->company->id) }}">
|
||||
{{ $user->company->name }}
|
||||
</a>
|
||||
@else
|
||||
{{ $user->company->name }}
|
||||
@endcan
|
||||
{!! $user->company->present()->formattedNameLink !!}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -572,7 +566,7 @@
|
||||
{{ trans('admin/users/table.location') }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{{ link_to_route('locations.show', $user->userloc->name, [$user->userloc->id]) }}
|
||||
{!! $user->userloc->present()->formattedNameLink !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@@ -596,7 +590,7 @@
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<a href="{{ route('departments.show', $user->department) }}">
|
||||
{{ $user->department->name }}
|
||||
{!! $user->department->present()->formattedNameLink !!}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user