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
|
@ -123,7 +123,7 @@ class ManufacturersController extends Controller
|
||||||
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the data
|
// Save the data
|
||||||
$manufacturer->name = $request->input('name');
|
$manufacturer->name = $request->input('name');
|
||||||
$manufacturer->url = $request->input('url');
|
$manufacturer->url = $request->input('url');
|
||||||
$manufacturer->support_url = $request->input('support_url');
|
$manufacturer->support_url = $request->input('support_url');
|
||||||
|
|
|
@ -23,8 +23,8 @@ class Manufacturer extends SnipeModel
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'name' => 'required|min:2|max:255|unique:manufacturers,name,NULL,id,deleted_at,NULL',
|
'name' => 'required|min:2|max:255|unique:manufacturers,name,NULL,id,deleted_at,NULL',
|
||||||
'url' => 'url|nullable',
|
'url' => 'url|nullable',
|
||||||
'support_url' => 'url|nullable',
|
|
||||||
'support_email' => 'email|nullable',
|
'support_email' => 'email|nullable',
|
||||||
|
'support_url' => 'starts_with:http://,https://,afp://,facetime://,file://,irc://','nullable',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = ['user_id'];
|
protected $hidden = ['user_id'];
|
||||||
|
|
|
@ -534,6 +534,20 @@ class AssetPresenter extends Presenter
|
||||||
return false;
|
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.
|
* Url to view this item.
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -596,19 +596,9 @@
|
||||||
{{ trans('admin/hardware/form.months') }}
|
{{ trans('admin/hardware/form.months') }}
|
||||||
|
|
||||||
@if ($asset->serial && $asset->model->manufacturer)
|
@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="{{ $asset->present()->supportUrl() }}" target="_blank">
|
||||||
<a href="https://checkcoverage.apple.com/?locale={{ (str_replace('-','_',\App\Models\Setting::getSettings()->locale)) }}" 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>
|
||||||
<i class="fa-brands fa-apple" aria-hidden="true"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
|
|
||||||
</a>
|
</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
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue