mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
27de5c62c5
|
@ -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
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
||||||
|
'support_url_help' => 'Use <code>{LOCALE}</code> and <code>{SERIAL}</code> in your URL as variables to have those values auto-populate when viewing assets.',
|
||||||
'does_not_exist' => 'Manufacturer does not exist.',
|
'does_not_exist' => 'Manufacturer does not exist.',
|
||||||
'assoc_users' => 'This manufacturer is currently associated with at least one model and cannot be deleted. Please update your models to no longer reference this manufacturer and try again. ',
|
'assoc_users' => 'This manufacturer is currently associated with at least one model and cannot be deleted. Please update your models to no longer reference this manufacturer and try again. ',
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
</label>
|
</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input class="form-control" type="text" name="support_url" id="support_url" value="{{ old('support_url', $item->support_url) }}" />
|
<input class="form-control" type="text" name="support_url" id="support_url" value="{{ old('support_url', $item->support_url) }}" />
|
||||||
|
<p class="help-block">{!! trans('admin/manufacturers/message.support_url_help') !!}</p>
|
||||||
{!! $errors->first('support_url', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
{!! $errors->first('support_url', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -269,12 +269,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((row.available_actions) && (row.available_actions.delete === true)) {
|
if ((row.available_actions) && (row.available_actions.delete === true)) {
|
||||||
|
|
||||||
|
// use the asset tag if no name is provided
|
||||||
|
var name_for_box = row.name
|
||||||
|
if (row.name=='') {
|
||||||
|
var name_for_box = row.asset_tag
|
||||||
|
}
|
||||||
|
|
||||||
actions += '<a href="{{ config('app.url') }}/' + dest + '/' + row.id + '" '
|
actions += '<a href="{{ config('app.url') }}/' + dest + '/' + row.id + '" '
|
||||||
+ ' class="btn btn-danger btn-sm delete-asset" data-tooltip="true" '
|
+ ' class="btn btn-danger btn-sm delete-asset" data-tooltip="true" '
|
||||||
+ ' data-toggle="modal" '
|
+ ' data-toggle="modal" '
|
||||||
+ ' data-content="{{ trans('general.sure_to_delete') }} ' + row.name + '?" '
|
+ ' data-content="{{ trans('general.sure_to_delete') }} ' + name_for_box + '?" '
|
||||||
+ ' data-title="{{ trans('general.delete') }}" onClick="return false;">'
|
+ ' data-title="{{ trans('general.delete') }}" onClick="return false;">'
|
||||||
+ '<i class="fas fa-trash" aria-hidden="true"></i><span class="sr-only">Delete</span></a> ';
|
+ '<i class="fas fa-trash" aria-hidden="true"></i><span class="sr-only">{{ trans('general.delete') }}</span></a> ';
|
||||||
} else {
|
} else {
|
||||||
actions += '<span data-tooltip="true" title="{{ trans('general.cannot_be_deleted') }}"><a class="btn btn-danger btn-sm delete-asset disabled" onClick="return false;"><i class="fas fa-trash"></i></a></span> ';
|
actions += '<span data-tooltip="true" title="{{ trans('general.cannot_be_deleted') }}"><a class="btn btn-danger btn-sm delete-asset disabled" onClick="return false;"><i class="fas fa-trash"></i></a></span> ';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue