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
7bffe30fae
|
@ -23,10 +23,10 @@ class ManufacturersController extends Controller
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$this->authorize('view', Manufacturer::class);
|
$this->authorize('view', Manufacturer::class);
|
||||||
$allowed_columns = ['id', 'name', 'url', 'support_url', 'support_email', 'support_phone', 'created_at', 'updated_at', 'image', 'assets_count', 'consumables_count', 'components_count', 'licenses_count'];
|
$allowed_columns = ['id', 'name', 'url', 'support_url', 'support_email', 'warranty_lookup_url', 'support_phone', 'created_at', 'updated_at', 'image', 'assets_count', 'consumables_count', 'components_count', 'licenses_count'];
|
||||||
|
|
||||||
$manufacturers = Manufacturer::select(
|
$manufacturers = Manufacturer::select(
|
||||||
['id', 'name', 'url', 'support_url', 'support_email', 'support_phone', 'created_at', 'updated_at', 'image', 'deleted_at']
|
['id', 'name', 'url', 'support_url', 'warranty_lookup_url', 'support_email', 'support_phone', 'created_at', 'updated_at', 'image', 'deleted_at']
|
||||||
)->withCount('assets as assets_count')->withCount('licenses as licenses_count')->withCount('consumables as consumables_count')->withCount('accessories as accessories_count');
|
)->withCount('assets as assets_count')->withCount('licenses as licenses_count')->withCount('consumables as consumables_count')->withCount('accessories as accessories_count');
|
||||||
|
|
||||||
if ($request->input('deleted') == 'true') {
|
if ($request->input('deleted') == 'true') {
|
||||||
|
@ -49,6 +49,10 @@ class ManufacturersController extends Controller
|
||||||
$manufacturers->where('support_url', '=', $request->input('support_url'));
|
$manufacturers->where('support_url', '=', $request->input('support_url'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->filled('warranty_lookup_url')) {
|
||||||
|
$manufacturers->where('warranty_lookup_url', '=', $request->input('warranty_lookup_url'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($request->filled('support_phone')) {
|
if ($request->filled('support_phone')) {
|
||||||
$manufacturers->where('support_phone', '=', $request->input('support_phone'));
|
$manufacturers->where('support_phone', '=', $request->input('support_phone'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ class ManufacturersController extends Controller
|
||||||
$manufacturer->user_id = Auth::id();
|
$manufacturer->user_id = Auth::id();
|
||||||
$manufacturer->url = $request->input('url');
|
$manufacturer->url = $request->input('url');
|
||||||
$manufacturer->support_url = $request->input('support_url');
|
$manufacturer->support_url = $request->input('support_url');
|
||||||
|
$manufacturer->warranty_lookup_url = $request->input('warranty_lookup_url');
|
||||||
$manufacturer->support_phone = $request->input('support_phone');
|
$manufacturer->support_phone = $request->input('support_phone');
|
||||||
$manufacturer->support_email = $request->input('support_email');
|
$manufacturer->support_email = $request->input('support_email');
|
||||||
$manufacturer = $request->handleImages($manufacturer);
|
$manufacturer = $request->handleImages($manufacturer);
|
||||||
|
@ -127,6 +128,7 @@ class ManufacturersController extends Controller
|
||||||
$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');
|
||||||
|
$manufacturer->warranty_lookup_url = $request->input('warranty_lookup_url');
|
||||||
$manufacturer->support_phone = $request->input('support_phone');
|
$manufacturer->support_phone = $request->input('support_phone');
|
||||||
$manufacturer->support_email = $request->input('support_email');
|
$manufacturer->support_email = $request->input('support_email');
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ class ManufacturersTransformer
|
||||||
'url' => e($manufacturer->url),
|
'url' => e($manufacturer->url),
|
||||||
'image' => ($manufacturer->image) ? Storage::disk('public')->url('manufacturers/'.e($manufacturer->image)) : null,
|
'image' => ($manufacturer->image) ? Storage::disk('public')->url('manufacturers/'.e($manufacturer->image)) : null,
|
||||||
'support_url' => e($manufacturer->support_url),
|
'support_url' => e($manufacturer->support_url),
|
||||||
|
'warranty_lookup_url' => e($manufacturer->warranty_lookup_url),
|
||||||
'support_phone' => e($manufacturer->support_phone),
|
'support_phone' => e($manufacturer->support_phone),
|
||||||
'support_email' => e($manufacturer->support_email),
|
'support_email' => e($manufacturer->support_email),
|
||||||
'assets_count' => (int) $manufacturer->assets_count,
|
'assets_count' => (int) $manufacturer->assets_count,
|
||||||
|
|
|
@ -24,7 +24,8 @@ class Manufacturer extends SnipeModel
|
||||||
'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_email' => 'email|nullable',
|
'support_email' => 'email|nullable',
|
||||||
'support_url' => 'starts_with:http://,https://,afp://,facetime://,file://,irc://','nullable',
|
'support_url' => 'nullable|url',
|
||||||
|
'warranty_lookup_url' => 'starts_with:http://,https://,afp://,facetime://,file://,irc://','nullable'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = ['user_id'];
|
protected $hidden = ['user_id'];
|
||||||
|
@ -51,6 +52,7 @@ class Manufacturer extends SnipeModel
|
||||||
'support_phone',
|
'support_phone',
|
||||||
'support_url',
|
'support_url',
|
||||||
'url',
|
'url',
|
||||||
|
'warranty_lookup_url',
|
||||||
];
|
];
|
||||||
|
|
||||||
use Searchable;
|
use Searchable;
|
||||||
|
|
|
@ -538,14 +538,12 @@ class AssetPresenter extends Presenter
|
||||||
* Used to take user created warranty URL and dynamically fill in the needed values per asset
|
* Used to take user created warranty URL and dynamically fill in the needed values per asset
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function supportUrl()
|
public function dynamicWarrantyUrl()
|
||||||
{
|
{
|
||||||
$tempurl = $this->model->model->manufacturer->support_url;
|
$warranty_lookup_url = $this->model->model->manufacturer->warranty_lookup_url;
|
||||||
|
$url = (str_replace('{LOCALE}',\App\Models\Setting::getSettings()->locale,$warranty_lookup_url));
|
||||||
$tempurl = (str_replace('{LOCALE}',\App\Models\Setting::getSettings()->locale,$tempurl));
|
$url = (str_replace('{SERIAL}',$this->model->serial,$url));
|
||||||
$tempurl = (str_replace('{SERIAL}',$this->model->serial,$tempurl));
|
return $url;
|
||||||
|
|
||||||
return $tempurl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,6 +78,15 @@ class ManufacturerPresenter extends Presenter
|
||||||
'visible' => true,
|
'visible' => true,
|
||||||
'formatter' => 'emailFormatter',
|
'formatter' => 'emailFormatter',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'field' => 'warranty_lookup_url',
|
||||||
|
'searchable' => true,
|
||||||
|
'sortable' => true,
|
||||||
|
'switchable' => true,
|
||||||
|
'title' => trans('admin/manufacturers/table.warranty_lookup_url'),
|
||||||
|
'visible' => false,
|
||||||
|
'formatter' => 'linkFormatter',
|
||||||
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'field' => 'assets_count',
|
'field' => 'assets_count',
|
||||||
|
|
|
@ -38,6 +38,7 @@ class ManufacturerFactory extends Factory
|
||||||
'name' => 'Apple',
|
'name' => 'Apple',
|
||||||
'url' => 'https://apple.com',
|
'url' => 'https://apple.com',
|
||||||
'support_url' => 'https://support.apple.com',
|
'support_url' => 'https://support.apple.com',
|
||||||
|
'warranty_lookup_url' => 'https://checkcoverage.apple.com',
|
||||||
'image' => 'apple.jpg',
|
'image' => 'apple.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
@ -50,6 +51,7 @@ class ManufacturerFactory extends Factory
|
||||||
'name' => 'Microsoft',
|
'name' => 'Microsoft',
|
||||||
'url' => 'https://microsoft.com',
|
'url' => 'https://microsoft.com',
|
||||||
'support_url' => 'https://support.microsoft.com',
|
'support_url' => 'https://support.microsoft.com',
|
||||||
|
'warranty_lookup_url' => 'https://account.microsoft.com/devices',
|
||||||
'image' => 'microsoft.png',
|
'image' => 'microsoft.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
@ -62,6 +64,7 @@ class ManufacturerFactory extends Factory
|
||||||
'name' => 'Dell',
|
'name' => 'Dell',
|
||||||
'url' => 'https://dell.com',
|
'url' => 'https://dell.com',
|
||||||
'support_url' => 'https://support.dell.com',
|
'support_url' => 'https://support.dell.com',
|
||||||
|
'warranty_lookup_url' => 'https://www.dell.com/support/home/en-us/Products/?app=warranty',
|
||||||
'image' => 'dell.png',
|
'image' => 'dell.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddWarrantyUrlToManufacturers extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('manufacturers', function (Blueprint $table) {
|
||||||
|
$table->string('warranty_lookup_url')->after('support_url')->nullable()->default(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('manufacturers', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('warranty_lookup_url');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ return array(
|
||||||
'support_email' => 'Support Email',
|
'support_email' => 'Support Email',
|
||||||
'support_phone' => 'Support Phone',
|
'support_phone' => 'Support Phone',
|
||||||
'support_url' => 'Support URL',
|
'support_url' => 'Support URL',
|
||||||
|
'warranty_lookup_url' => 'Warranty Lookup URL',
|
||||||
'update' => 'Update Manufacturer',
|
'update' => 'Update Manufacturer',
|
||||||
'url' => 'URL',
|
'url' => 'URL',
|
||||||
|
|
||||||
|
|
|
@ -595,9 +595,9 @@
|
||||||
{{ $asset->warranty_months }}
|
{{ $asset->warranty_months }}
|
||||||
{{ trans('admin/hardware/form.months') }}
|
{{ trans('admin/hardware/form.months') }}
|
||||||
|
|
||||||
@if ($asset->serial && $asset->model->manufacturer)
|
@if (($asset->model->manufacturer) && ($asset->model->manufacturer->warranty_lookup_url!=''))
|
||||||
<a href="{{ $asset->present()->supportUrl() }}" target="_blank">
|
<a href="{{ $asset->present()->dynamicWarrantyUrl() }}" 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 fa-external-link"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,11 +26,21 @@
|
||||||
</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>
|
||||||
|
|
||||||
|
<!-- Warranty Lookup URL -->
|
||||||
|
<div class="form-group {{ $errors->has('warranty_lookup_url') ? ' has-error' : '' }}">
|
||||||
|
<label for="support_url" class="col-md-3 control-label">{{ trans('admin/manufacturers/table.warranty_lookup_url') }}
|
||||||
|
</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input class="form-control" type="text" name="warranty_lookup_url" id="warranty_lookup_url" value="{{ old('warranty_lookup_url', $item->warranty_lookup_url) }}" />
|
||||||
|
<p class="help-block">{!! trans('admin/manufacturers/message.support_url_help') !!}</p>
|
||||||
|
{!! $errors->first('warranty_lookup_url', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Support Phone -->
|
<!-- Support Phone -->
|
||||||
<div class="form-group {{ $errors->has('support_phone') ? ' has-error' : '' }}">
|
<div class="form-group {{ $errors->has('support_phone') ? ' has-error' : '' }}">
|
||||||
<label for="support_phone" class="col-md-3 control-label">{{ trans('admin/manufacturers/table.support_phone') }}
|
<label for="support_phone" class="col-md-3 control-label">{{ trans('admin/manufacturers/table.support_phone') }}
|
||||||
|
|
Loading…
Reference in a new issue