mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Merge pull request #12906 from akemidx/feature/sc-20622
Dynamic warranty link for manufacturers' support urls
This commit is contained in:
commit
5eac314f4d
|
@ -23,8 +23,8 @@ class Manufacturer extends SnipeModel
|
|||
protected $rules = [
|
||||
'name' => 'required|min:2|max:255|unique:manufacturers,name,NULL,id,deleted_at,NULL',
|
||||
'url' => 'url|nullable',
|
||||
'support_url' => 'url|nullable',
|
||||
'support_email' => 'email|nullable',
|
||||
'support_url' => 'starts_with:http://,https://,afp://,facetime://,file://,irc://','nullable',
|
||||
];
|
||||
|
||||
protected $hidden = ['user_id'];
|
||||
|
|
|
@ -534,6 +534,20 @@ class AssetPresenter extends Presenter
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to take user created warranty URL and dynamically fill in the needed values per asset
|
||||
* @return string
|
||||
*/
|
||||
public function supportUrl()
|
||||
{
|
||||
$tempurl = $this->model->model->manufacturer->support_url;
|
||||
|
||||
$tempurl = (str_replace('{LOCALE}',\App\Models\Setting::getSettings()->locale,$tempurl));
|
||||
$tempurl = (str_replace('{SERIAL}',$this->model->serial,$tempurl));
|
||||
|
||||
return $tempurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Url to view this item.
|
||||
* @return string
|
||||
|
|
|
@ -596,19 +596,9 @@
|
|||
{{ trans('admin/hardware/form.months') }}
|
||||
|
||||
@if ($asset->serial && $asset->model->manufacturer)
|
||||
@if ((strtolower($asset->model->manufacturer->name) == "apple") || (str_starts_with(str_replace(' ','',strtolower($asset->model->manufacturer->name)),"appleinc")))
|
||||
<a href="https://checkcoverage.apple.com/?locale={{ (str_replace('-','_',\App\Models\Setting::getSettings()->locale)) }}" target="_blank">
|
||||
<i class="fa-brands fa-apple" aria-hidden="true"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
|
||||
<a href="{{ $asset->present()->supportUrl() }}" target="_blank">
|
||||
<i class="fa fa-external-link" style="width:25px;height:25px;"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
|
||||
</a>
|
||||
@elseif ((strtolower($asset->model->manufacturer->name) == "dell") || (str_starts_with(str_replace(' ','',strtolower($asset->model->manufacturer->name)),"dellinc")))
|
||||
<a href="https://www.dell.com/support/home/en-us?app=warranty" target="_blank">
|
||||
<img src="/img/demo/manufacturers/dellicon.png" style="width:25px;height:25px;"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
|
||||
</a>
|
||||
@elseif ((strtolower($asset->model->manufacturer->name) == "lenovo") || (str_starts_with(str_replace(' ','',strtolower($asset->model->manufacturer->name)),"lenovoinc")))
|
||||
<a href="https://pcsupport.lenovo.com/us/en/warrantylookup#/" target="_blank">
|
||||
<img src="/img/demo/manufacturers/lenovoicon.png" style="width:25px;height:25px;"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue