Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2023-04-26 15:15:43 -07:00
commit 27de5c62c5
7 changed files with 29 additions and 16 deletions

View file

@ -123,7 +123,7 @@ class ManufacturersController extends Controller
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->url = $request->input('url');
$manufacturer->support_url = $request->input('support_url');

View file

@ -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'];

View file

@ -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

View file

@ -2,6 +2,7 @@
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.',
'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. ',

View file

@ -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>

View file

@ -26,6 +26,7 @@
</label>
<div class="col-md-6">
<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>') !!}
</div>
</div>

View file

@ -269,12 +269,19 @@
}
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 + '" '
+ ' class="btn btn-danger btn-sm delete-asset" data-tooltip="true" '
+ ' 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;">'
+ '<i class="fas fa-trash" aria-hidden="true"></i><span class="sr-only">Delete</span></a>&nbsp;';
+ '<i class="fas fa-trash" aria-hidden="true"></i><span class="sr-only">{{ trans('general.delete') }}</span></a>&nbsp;';
} 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>&nbsp;';
}