Features/image uploads (#4320)

* Locations API support for image

* Added manufacturers API support for image

* Added manufacturers API support for image

* Added image support for locations add/update

* Added manufacturer image upload support to controller

* General image string

* Added blade support for image uploads/delete image

* Added $request support (from Input::)

* Added image support in API transformers

* Added image to Manufacturers presenter for data table

* Migration to create image fields

* Ignore the contents of the new image directories

* Create new image upload directories

* Created components/consumables uploads directory

* Fixed missing textSearch scope from companies

* Added ignore for companies uploads directory

* Added blade support for image upload

* Fixed path to upload directory on edit

* Added company image upport to transformers, controllers

* Added image support for categories

* Added support for images in Departments

* Added support for image in Consumables

* Added image support for components
This commit is contained in:
snipe 2017-10-25 22:35:58 -07:00 committed by GitHub
parent b083541723
commit 75b527ab59
53 changed files with 595 additions and 102 deletions

7
.gitignore vendored
View file

@ -28,8 +28,15 @@ public/uploads/logo.svg
public/uploads/models/*
public/uploads/suppliers/*
public/uploads/accessories/*
public/uploads/locations/*
public/uploads/manufacturers/*
public/uploads/components/*
public/uploads/consumables/*
public/uploads/companies/*
public/uploads/categories/*
public/uploads/users/*
storage/app/private_uploads/users/*
public/uploads/departments/*
storage/debugbar/
storage/dumps/*
storage/laravel-backups

View file

@ -20,9 +20,9 @@ class CategoriesController extends Controller
public function index(Request $request)
{
$this->authorize('view', Category::class);
$allowed_columns = ['id', 'name','category_type','use_default_eula','eula_text', 'require_acceptance','checkin_email', 'assets_count', 'accessories_count', 'consumables_count', 'components_count'];
$allowed_columns = ['id', 'name','category_type','use_default_eula','eula_text', 'require_acceptance','checkin_email', 'assets_count', 'accessories_count', 'consumables_count', 'components_count', 'image'];
$categories = Category::select(['id', 'created_at', 'updated_at', 'name','category_type','use_default_eula','eula_text', 'require_acceptance','checkin_email'])
$categories = Category::select(['id', 'created_at', 'updated_at', 'name','category_type','use_default_eula','eula_text', 'require_acceptance','checkin_email','image'])
->withCount('assets', 'accessories', 'consumables', 'components');
if ($request->has('search')) {

View file

@ -34,7 +34,7 @@ class ComponentsController extends Controller
$offset = request('offset', 0);
$limit = request('limit', 50);
$allowed_columns = ['id','name','min_amt','order_number','serial','purchase_date','purchase_cost','company','category','qty','location'];
$allowed_columns = ['id','name','min_amt','order_number','serial','purchase_date','purchase_cost','company','category','qty','location','image'];
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';

View file

@ -43,7 +43,7 @@ class ConsumablesController extends Controller
$offset = request('offset', 0);
$limit = request('limit', 50);
$allowed_columns = ['id','name','order_number','min_amt','purchase_date','purchase_cost','company','category','model_number', 'item_no', 'manufacturer','location','qty'];
$allowed_columns = ['id','name','order_number','min_amt','purchase_date','purchase_cost','company','category','model_number', 'item_no', 'manufacturer','location','qty','image'];
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';

View file

@ -21,7 +21,7 @@ class DepartmentsController extends Controller
public function index(Request $request)
{
$this->authorize('view', Department::class);
$allowed_columns = ['id','name'];
$allowed_columns = ['id','name','image'];
$departments = Department::select([
'id',
@ -30,7 +30,8 @@ class DepartmentsController extends Controller
'company_id',
'manager_id',
'created_at',
'updated_at'
'updated_at',
'image'
])->with('users')->with('location')->with('manager')->with('company')->withCount('users');
if ($request->has('search')) {

View file

@ -21,7 +21,7 @@ class LocationsController extends Controller
{
$this->authorize('view', Location::class);
$allowed_columns = ['id','name','address','address2','city','state','country','zip','created_at',
'updated_at','parent_id', 'manager_id'];
'updated_at','parent_id', 'manager_id','image'];
$locations = Location::with('parent', 'manager', 'childLocations')->select([
'locations.id',
@ -36,6 +36,7 @@ class LocationsController extends Controller
'locations.manager_id',
'locations.created_at',
'locations.updated_at',
'locations.image',
'locations.currency'
])->withCount('locationAssets')
->withCount('assignedAssets')

View file

@ -21,10 +21,10 @@ class ManufacturersController extends Controller
public function index(Request $request)
{
$this->authorize('view', Manufacturer::class);
$allowed_columns = ['id','name','url','support_url','support_email','support_phone','created_at','updated_at'];
$allowed_columns = ['id','name','url','support_url','support_email','support_phone','created_at','updated_at','image'];
$manufacturers = Manufacturer::select(
array('id','name','url','support_url','support_email','support_phone','created_at','updated_at')
array('id','name','url','support_url','support_email','support_phone','created_at','updated_at','image')
)->withCount('assets')->withCount('licenses')->withCount('consumables')->withCount('accessories');

View file

@ -23,7 +23,7 @@ class SuppliersController extends Controller
$allowed_columns = ['id','name','address','phone','contact','fax','email','image','assets_count','licenses_count', 'accessories_count'];
$suppliers = Supplier::select(
array('id','name','address','address2','city','state','country','fax', 'phone','email','contact','created_at','updated_at','deleted_at')
array('id','name','address','address2','city','state','country','fax', 'phone','email','contact','created_at','updated_at','deleted_at','image')
)->withCount('assets')->withCount('licenses')->withCount('accessories')->whereNull('deleted_at');

View file

@ -15,6 +15,8 @@ use Lang;
use Redirect;
use Str;
use View;
use Image;
use App\Http\Requests\ImageUploadRequest;
/**
* This class controls all actions related to Categories for
@ -67,7 +69,7 @@ class CategoriesController extends Controller
* @since [v1.0]
* @return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
// create a new model instance
$category = new Category();
@ -80,6 +82,18 @@ class CategoriesController extends Controller
$category->checkin_email = $request->input('checkin_email', '0');
$category->user_id = Auth::id();
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/categories/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$category->image = $file_name;
}
if ($category->save()) {
return redirect()->route('categories.index')->with('success', trans('admin/categories/message.create.success'));
}
@ -118,7 +132,7 @@ class CategoriesController extends Controller
* @return \Illuminate\Http\RedirectResponse
* @since [v1.0]
*/
public function update(Request $request, $categoryId = null)
public function update(ImageUploadRequest $request, $categoryId = null)
{
// Check if the blog post exists
if (is_null($category = Category::find($categoryId))) {
@ -136,6 +150,20 @@ class CategoriesController extends Controller
$category->require_acceptance = $request->input('require_acceptance', '0');
$category->checkin_email = $request->input('checkin_email', '0');
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/categories/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$category->image = $file_name;
} elseif ($request->input('image_delete')=='1') {
$category->image = null;
}
if ($category->save()) {
// Redirect to the new category page
return redirect()->route('categories.index')->with('success', trans('admin/categories/message.update.success'));

View file

@ -7,6 +7,8 @@ use Lang;
use Redirect;
use View;
use Illuminate\Http\Request;
use Image;
use App\Http\Requests\ImageUploadRequest;
/**
* This controller handles all actions related to Companies for
@ -50,11 +52,22 @@ final class CompaniesController extends Controller
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$company = new Company;
$company->name = $request->input('name');
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/companies/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$company->image = $file_name;
}
if ($company->save()) {
return redirect()->route('companies.index')
->with('success', trans('admin/companies/message.create.success'));
@ -89,7 +102,7 @@ final class CompaniesController extends Controller
* @param int $companyId
* @return \Illuminate\Http\RedirectResponse
*/
public function update(Request $request, $companyId)
public function update(ImageUploadRequest $request, $companyId)
{
if (is_null($company = Company::find($companyId))) {
return redirect()->route('companies.index')->with('error', trans('admin/companies/message.does_not_exist'));
@ -97,6 +110,20 @@ final class CompaniesController extends Controller
$company->name = $request->input('name');
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/companies/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$company->image = $file_name;
} elseif ($request->input('image_delete')=='1') {
$company->image = null;
}
if ($company->save()) {
return redirect()->route('companies.index')
->with('success', trans('admin/companies/message.update.success'));

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Helpers\Helper;
use App\Http\Requests\ImageUploadRequest;
use App\Models\Company;
use App\Models\Component;
use App\Models\CustomField;
@ -21,6 +22,7 @@ use View;
use Validator;
use Illuminate\Http\Request;
use Gate;
use Image;
/**
* This class controls all actions related to Components for
@ -74,7 +76,7 @@ class ComponentsController extends Controller
* @since [v3.0]
* @return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Component::class);
$component = new Component();
@ -90,6 +92,18 @@ class ComponentsController extends Controller
$component->qty = $request->input('qty');
$component->user_id = Auth::id();
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/components/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$component->image = $file_name;
}
if ($component->save()) {
return redirect()->route('components.index')->with('success', trans('admin/components/message.create.success'));
}
@ -129,7 +143,7 @@ class ComponentsController extends Controller
* @since [v3.0]
* @return \Illuminate\Http\RedirectResponse
*/
public function update($componentId = null)
public function update(ImageUploadRequest $request, $componentId = null)
{
if (is_null($component = Component::find($componentId))) {
return redirect()->route('components.index')->with('error', trans('admin/components/message.does_not_exist'));
@ -150,6 +164,19 @@ class ComponentsController extends Controller
$component->purchase_cost = request('purchase_cost');
$component->qty = Input::get('qty');
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/components/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$component->image = $file_name;
} elseif ($request->input('image_delete')=='1') {
$component->image = null;
}
if ($component->save()) {
return redirect()->route('components.index')->with('success', trans('admin/components/message.update.success'));
}

View file

@ -19,6 +19,8 @@ use Slack;
use Str;
use View;
use Gate;
use Image;
use App\Http\Requests\ImageUploadRequest;
/**
* This controller handles all actions related to Consumables for
@ -72,24 +74,36 @@ class ConsumablesController extends Controller
* @since [v1.0]
* @return \Illuminate\Http\RedirectResponse
*/
public function store()
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Consumable::class);
$consumable = new Consumable();
$consumable->name = Input::get('name');
$consumable->category_id = Input::get('category_id');
$consumable->location_id = Input::get('location_id');
$consumable->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$consumable->order_number = Input::get('order_number');
$consumable->min_amt = Input::get('min_amt');
$consumable->manufacturer_id = Input::get('manufacturer_id');
$consumable->model_number = Input::get('model_number');
$consumable->item_no = Input::get('item_no');
$consumable->purchase_date = Input::get('purchase_date');
$consumable->purchase_cost = Helper::ParseFloat(Input::get('purchase_cost'));
$consumable->qty = Input::get('qty');
$consumable->name = $request->input('name');
$consumable->category_id = $request->input('category_id');
$consumable->location_id = $request->input('location_id');
$consumable->company_id = Company::getIdForCurrentUser($request->input('company_id'));
$consumable->order_number = $request->input('order_number');
$consumable->min_amt = $request->input('min_amt');
$consumable->manufacturer_id = $request->input('manufacturer_id');
$consumable->model_number = $request->input('model_number');
$consumable->item_no = $request->input('item_no');
$consumable->purchase_date = $request->input('purchase_date');
$consumable->purchase_cost = Helper::ParseFloat($request->input('purchase_cost'));
$consumable->qty = $request->input('qty');
$consumable->user_id = Auth::id();
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/consumables/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$consumable->image = $file_name;
}
if ($consumable->save()) {
return redirect()->route('consumables.index')->with('success', trans('admin/consumables/message.create.success'));
}
@ -132,7 +146,7 @@ class ConsumablesController extends Controller
* @since [v1.0]
* @return \Illuminate\Http\RedirectResponse
*/
public function update($consumableId = null)
public function update(ImageUploadRequest $request, $consumableId = null)
{
if (is_null($consumable = Consumable::find($consumableId))) {
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.does_not_exist'));
@ -140,19 +154,32 @@ class ConsumablesController extends Controller
$this->authorize($consumable);
$consumable->name = Input::get('name');
$consumable->category_id = Input::get('category_id');
$consumable->location_id = Input::get('location_id');
$consumable->company_id = Company::getIdForCurrentUser(Input::get('company_id'));
$consumable->order_number = Input::get('order_number');
$consumable->min_amt = Input::get('min_amt');
$consumable->manufacturer_id = Input::get('manufacturer_id');
$consumable->model_number = Input::get('model_number');
$consumable->item_no = Input::get('item_no');
$consumable->purchase_date = Input::get('purchase_date');
$consumable->name = $request->input('name');
$consumable->category_id = $request->input('category_id');
$consumable->location_id = $request->input('location_id');
$consumable->company_id = Company::getIdForCurrentUser($request->input('company_id'));
$consumable->order_number = $request->input('order_number');
$consumable->min_amt = $request->input('min_amt');
$consumable->manufacturer_id = $request->input('manufacturer_id');
$consumable->model_number = $request->input('model_number');
$consumable->item_no = $request->input('item_no');
$consumable->purchase_date = $request->input('purchase_date');
$consumable->purchase_cost = Helper::ParseFloat(Input::get('purchase_cost'));
$consumable->qty = Helper::ParseFloat(Input::get('qty'));
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/consumables/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$consumable->image = $file_name;
} elseif ($request->input('image_delete')=='1') {
$consumable->image = null;
}
if ($consumable->save()) {
return redirect()->route('consumables.index')->with('success', trans('admin/consumables/message.update.success'));
}

View file

@ -6,6 +6,8 @@ use Illuminate\Http\Request;
use App\Models\Department;
use App\Helpers\Helper;
use Auth;
use Image;
use App\Http\Requests\ImageUploadRequest;
class DepartmentsController extends Controller
{
@ -43,7 +45,7 @@ class DepartmentsController extends Controller
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$this->authorize('create', Department::class);
$department = new Department;
@ -51,6 +53,17 @@ class DepartmentsController extends Controller
$department->user_id = Auth::user()->id;
$department->manager_id = ($request->has('manager_id' ) ? $request->input('manager_id') : null);
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/departments/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$department->image = $file_name;
}
if ($department->save()) {
return redirect()->route("departments.index")->with('success', trans('admin/departments/message.create.success'));
}
@ -145,6 +158,20 @@ class DepartmentsController extends Controller
}
$department->fill($request->all());
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/departments/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$department->image = $file_name;
} elseif ($request->input('image_delete')=='1') {
$department->image = null;
}
$department->manager_id = ($request->has('manager_id' ) ? $request->input('manager_id') : null);
if ($department->save()) {

View file

@ -16,6 +16,8 @@ use Validator;
use View;
use Auth;
use Symfony\Component\HttpFoundation\JsonResponse;
use Image;
use App\Http\Requests\ImageUploadRequest;
/**
* This controller handles all actions related to Locations for
@ -77,22 +79,33 @@ class LocationsController extends Controller
* @since [v1.0]
* @return \Illuminate\Http\RedirectResponse
*/
public function store()
public function store(ImageUploadRequest $request)
{
$location = new Location();
$location->name = Input::get('name');
$location->parent_id = Input::get('parent_id', null);
$location->currency = Input::get('currency', '$');
$location->address = Input::get('address');
$location->address2 = Input::get('address2');
$location->city = Input::get('city');
$location->state = Input::get('state');
$location->country = Input::get('country');
$location->zip = Input::get('zip');
$location->ldap_ou = Input::get('ldap_ou');
$location->manager_id = Input::get('manager_id');
$location->name = $request->input('name');
$location->parent_id = $request->input('parent_id', null);
$location->currency = $request->input('currency', '$');
$location->address = $request->input('address');
$location->address2 = $request->input('address2');
$location->city = $request->input('city');
$location->state = $request->input('state');
$location->country = $request->input('country');
$location->zip = $request->input('zip');
$location->ldap_ou = $request->input('ldap_ou');
$location->manager_id = $request->input('manager_id');
$location->user_id = Auth::id();
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/locations/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$location->image = $file_name;
}
if ($location->save()) {
return redirect()->route("locations.index")->with('success', trans('admin/locations/message.create.success'));
}
@ -108,7 +121,7 @@ class LocationsController extends Controller
* @since [v1.0]
* @return String JSON
*/
public function apiStore()
public function apiStore(Request $request)
{
$new['currency']=Setting::first()->default_currency;
@ -116,13 +129,13 @@ class LocationsController extends Controller
$location = new Location();
// Save the location data
$location->name = Input::get('name');
$location->name = $request->input('name');
$location->currency = Setting::first()->default_currency; //e(Input::get('currency'));
$location->address = ''; //e(Input::get('address'));
// $location->address2 = e(Input::get('address2'));
$location->city = Input::get('city');
$location->city = $request->input('city');
$location->state = '';//e(Input::get('state'));
$location->country = Input::get('country');
$location->country = $request->input('country');
// $location->zip = e(Input::get('zip'));
$location->user_id = Auth::id();
@ -172,7 +185,7 @@ class LocationsController extends Controller
* @since [v1.0]
* @return \Illuminate\Http\RedirectResponse
*/
public function update($locationId = null)
public function update(ImageUploadRequest $request, $locationId = null)
{
// Check if the location exists
if (is_null($location = Location::find($locationId))) {
@ -180,24 +193,35 @@ class LocationsController extends Controller
}
// Update the location data
$location->name = Input::get('name');
$location->parent_id = Input::get('parent_id', null);
$location->currency = Input::get('currency', '$');
$location->address = Input::get('address');
$location->address2 = Input::get('address2');
$location->city = Input::get('city');
$location->state = Input::get('state');
$location->country = Input::get('country');
$location->zip = Input::get('zip');
$location->ldap_ou = Input::get('ldap_ou');
$location->manager_id = Input::get('manager_id');
$location->name = $request->input('name');
$location->parent_id = $request->input('parent_id', null);
$location->currency = $request->input('currency', '$');
$location->address = $request->input('address');
$location->address2 = $request->input('address2');
$location->city = $request->input('city');
$location->state = $request->input('state');
$location->country = $request->input('country');
$location->zip = $request->input('zip');
$location->ldap_ou = $request->input('ldap_ou');
$location->manager_id = $request->input('manager_id');
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/locations/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$location->image = $file_name;
} elseif ($request->input('image_delete')=='1') {
$location->image = null;
}
// Was the location updated?
if ($location->save()) {
// Redirect to the saved location page
return redirect()->route("locations.index")->with('success', trans('admin/locations/message.update.success'));
}
// Redirect to the location management page
return redirect()->back()->withInput()->withInput()->withErrors($location->getErrors());
}
@ -211,20 +235,22 @@ class LocationsController extends Controller
*/
public function destroy($locationId)
{
// Check if the location exists
if (is_null($location = Location::find($locationId))) {
// Redirect to the blogs management page
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.not_found'));
}
if ($location->users->count() > 0) {
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_users'));
} elseif ($location->childLocations->count() > 0) {
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_child_loc'));
} elseif ($location->assets->count() > 0) {
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_assets'));
} elseif ($location->assignedassets->count() > 0) {
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_assets'));
} else {
$location->delete();
return redirect()->to(route('locations.index'))->with('success', trans('admin/locations/message.delete.success'));
@ -248,11 +274,8 @@ class LocationsController extends Controller
if (isset($location->id)) {
return view('locations/view', compact('location'));
}
// Prepare the error message
$error = trans('admin/locations/message.does_not_exist', compact('id'));
// Redirect to the user management page
return redirect()->route('locations.index')->with('error', $error);
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist', compact('id')));
}
}

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Helpers\Helper;
use App\Http\Requests\ImageUploadRequest;
use App\Models\CustomField;
use App\Models\Manufacturer;
use Auth;
@ -13,6 +14,7 @@ use Redirect;
use Str;
use View;
use Illuminate\Http\Request;
use Image;
/**
* This controller handles all actions related to Manufacturers for
@ -60,7 +62,7 @@ class ManufacturersController extends Controller
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(Request $request)
public function store(ImageUploadRequest $request)
{
$manufacturer = new Manufacturer;
@ -72,6 +74,18 @@ class ManufacturersController extends Controller
$manufacturer->support_email = $request->input('support_email');
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/manufacturers/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$manufacturer->image = $file_name;
}
if ($manufacturer->save()) {
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.create.success'));
@ -124,6 +138,20 @@ class ManufacturersController extends Controller
$manufacturer->support_phone = $request->input('support_phone');
$manufacturer->support_email = $request->input('support_email');
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/manufacturers/'.$file_name);
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$manufacturer->image = $file_name;
} elseif ($request->input('image_delete')=='1') {
$manufacturer->image = null;
}
if ($manufacturer->save()) {
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.update.success'));
}

View file

@ -77,11 +77,11 @@ class SuppliersController extends Controller
$supplier->url = $supplier->addhttp(request('url'));
$supplier->user_id = Auth::id();
if (Input::file('image')) {
if ($request->file('image')) {
$image = $request->file('image');
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/suppliers/'.$file_name);
Image::make($image->getRealPath())->resize(300, null, function ($constraint) {
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
@ -89,7 +89,6 @@ class SuppliersController extends Controller
}
if ($supplier->save()) {
// Redirect to the nw supplier page
return redirect()->route('suppliers.index')->with('success', trans('admin/suppliers/message.create.success'));
}
return redirect()->back()->withInput()->withErrors($supplier->getErrors());
@ -160,16 +159,16 @@ class SuppliersController extends Controller
$supplier->notes = request('notes');
if (Input::file('image')) {
if ($request->file('image')) {
$image = $request->file('image');
$file_name = 'suppliers-'.str_random(25).".".$image->getClientOriginalExtension();
$file_name = str_random(25).".".$image->getClientOriginalExtension();
$path = public_path('uploads/suppliers/'.$file_name);
Image::make($image->getRealPath())->resize(300, null, function ($constraint) {
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->save($path);
$supplier->image = $file_name;
} elseif (request('image_delete') == 1) {
} elseif ($request->input('image_delete')=='1') {
$supplier->image = null;
}

View file

@ -25,6 +25,7 @@ class CategoriesTransformer
$array = [
'id' => (int) $category->id,
'name' => e($category->name),
'image' => ($category->image) ? e(url('/').'/uploads/categories/'.e($category->image)) : null,
'type' => e($category->category_type),
'eula' => ($category->getEula()) ? true : false,
'checkin_email' => ($category->checkin_email =='1') ? true : false,

View file

@ -25,6 +25,7 @@ class CompaniesTransformer
$array = [
'id' => (int) $company->id,
'name' => e($company->name),
'image' => ($company->image) ? e(url('/').'/uploads/companies/'.e($company->image)) : null,
"created_at" => Helper::getFormattedDateObject($company->created_at, 'datetime'),
"updated_at" => Helper::getFormattedDateObject($company->updated_at, 'datetime'),
"assets_count" => (int) $company->assets_count,

View file

@ -22,7 +22,8 @@ class ComponentsTransformer
$array = [
'id' => (int) $component->id,
'name' => e($component->name),
'serial_number' => e($component->serial),
'image' => ($component->image) ? e(url('/').'/uploads/components/'.e($component->image)) : null,
'serial_number' => ($component->serial) ? e($component->serial) : null,
'location' => ($component->location) ? [
'id' => (int) $component->location->id,
'name' => e($component->location->name)

View file

@ -22,6 +22,8 @@ class ConsumablesTransformer
{
$array = [
'id' => (int) $consumable->id,
'name' => e($consumable->name),
'image' => ($consumable->image) ? e(url('/').'/uploads/consumables/'.e($consumable->image)) : null,
'category' => ($consumable->category) ? ['id' => $consumable->category->id, 'name' => e($consumable->category->name)] : null,
'company' => ($consumable->company) ? ['id' => (int) $consumable->company->id, 'name' => e($consumable->company->name)] : null,
'item_no' => e($consumable->item_no),
@ -29,7 +31,6 @@ class ConsumablesTransformer
'manufacturer' => ($consumable->manufacturer) ? ['id' => (int) $consumable->manufacturer->id, 'name' => e($consumable->manufacturer->name)] : null,
'min_amt' => (int) $consumable->min_amt,
'model_number' => e($consumable->model_number),
'name' => e($consumable->name),
'remaining' => $consumable->numRemaining(),
'order_number' => e($consumable->order_number),
'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost),

View file

@ -25,6 +25,7 @@ class DepartmentsTransformer
$array = [
'id' => (int) $department->id,
'name' => e($department->name),
'image' => ($department->image) ? e(url('/').'/uploads/departments/'.e($department->image)) : null,
'company' => ($department->company) ? [
'id' => (int) $department->company->id,
'name'=> e($department->company->name)

View file

@ -33,6 +33,7 @@ class LocationsTransformer
$array = [
'id' => (int) $location->id,
'name' => e($location->name),
'image' => ($location->image) ? e(url('/').'/uploads/locations/'.e($location->image)) : null,
'address' => e($location->address),
'city' => e($location->city),
'state' => e($location->state),

View file

@ -26,6 +26,7 @@ class ManufacturersTransformer
'id' => (int) $manufacturer->id,
'name' => e($manufacturer->name),
'url' => e($manufacturer->url),
'image' => ($manufacturer->image) ? e(url('/').'/uploads/manufacturers/'.e($manufacturer->image)) : null,
'support_url' => e($manufacturer->support_url),
'support_phone' => e($manufacturer->support_phone),
'support_email' => e($manufacturer->support_email),

View file

@ -25,6 +25,7 @@ class SuppliersTransformer
$array = [
'id' => (int) $supplier->id,
'name' => e($supplier->name),
'image' => ($supplier->image) ? e(url('/').'/uploads/suppliers/'.e($supplier->image)) : null,
'address' => ($supplier->address) ? e($supplier->address) : null,
'address2' => ($supplier->address2) ? e($supplier->address2) : null,
'city' => ($supplier->city) ? e($supplier->city) : null,
@ -38,7 +39,6 @@ class SuppliersTransformer
'assets_count' => (int) $supplier->assets_count,
'accessories_count' => (int) $supplier->accessories_count,
'licenses_count' => (int) $supplier->licenses_count,
'image' => ($supplier->image) ? url('/').'/uploads/suppliers/'.e($supplier->image) : null,
'notes' => ($supplier->notes) ? e($supplier->notes) : null,
'created_at' => Helper::getFormattedDateObject($supplier->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($supplier->updated_at, 'datetime'),

View file

@ -192,4 +192,20 @@ final class Company extends SnipeModel
{
return $this->hasMany(Component::class);
}
/**
* Query builder scope to search on text
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
* @param text $search Search term
*
* @return Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeTextSearch($query, $search)
{
return $query->where(function ($query) use ($search) {
$query->where('name', 'LIKE', '%'.$search.'%');
});
}
}

View file

@ -32,6 +32,13 @@ class CategoryPresenter extends Presenter
"title" => trans('general.name'),
"visible" => true,
"formatter" => 'categoriesLinkFormatter',
],[
"field" => "image",
"searchable" => false,
"sortable" => true,
"title" => trans('general.image'),
"visible" => true,
"formatter" => 'imageFormatter',
],[
"field" => "type",
"searchable" => true,

View file

@ -30,6 +30,14 @@ class CompanyPresenter extends Presenter
"title" => trans('admin/companies/table.name'),
"visible" => true,
"formatter" => 'companiesLinkFormatter',
],[
"field" => "image",
"searchable" => false,
"sortable" => true,
"switchable" => true,
"title" => trans('general.image'),
"visible" => true,
"formatter" => 'imageFormatter',
],[
"field" => "users_count",
"searchable" => false,

View file

@ -42,6 +42,14 @@ class ComponentPresenter extends Presenter
"title" => trans('general.name'),
"visible" => true,
"formatter" => 'componentsLinkFormatter',
], [
"field" => "image",
"searchable" => false,
"sortable" => true,
"switchable" => true,
"title" => trans('general.image'),
"visible" => false,
"formatter" => 'imageFormatter',
], [
"field" => "category",
"searchable" => true,

View file

@ -41,6 +41,15 @@ class ConsumablePresenter extends Presenter
"title" => trans('general.name'),
"visible" => true,
"formatter" => 'consumablesLinkFormatter',
],
[
"field" => "image",
"searchable" => false,
"sortable" => true,
"switchable" => true,
"title" => trans('general.image'),
"visible" => false,
"formatter" => 'imageFormatter',
], [
"field" => "category",
"searchable" => true,

View file

@ -35,6 +35,15 @@ class ManufacturerPresenter extends Presenter
"visible" => true,
"formatter" => "manufacturersLinkFormatter"
],
[
"field" => "image",
"searchable" => false,
"sortable" => true,
"switchable" => true,
"title" => trans('general.image'),
"visible" => true,
"formatter" => "imageFormatter"
],
[
"field" => "url",
"searchable" => true,
@ -44,7 +53,6 @@ class ManufacturerPresenter extends Presenter
"visible" => true,
"formatter" => "linkFormatter"
],
[
"field" => "support_url",
"searchable" => true,

View file

@ -0,0 +1,71 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddImagesUploadsToLocationsManufacturersEtc extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('categories', function (Blueprint $table) {
$table->string('image')->nullable()->default(null);
});
Schema::table('companies', function (Blueprint $table) {
$table->string('image')->nullable()->default(null);
});
Schema::table('components', function (Blueprint $table) {
$table->string('image')->nullable()->default(null);
});
Schema::table('consumables', function (Blueprint $table) {
$table->string('image')->nullable()->default(null);
});
Schema::table('departments', function (Blueprint $table) {
$table->string('image')->nullable()->default(null);
});
Schema::table('locations', function (Blueprint $table) {
$table->string('image')->nullable()->default(null);
});
Schema::table('manufacturers', function (Blueprint $table) {
$table->string('image')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('categories', function (Blueprint $table) {
$table->dropColumn('image');
});
Schema::table('companies', function (Blueprint $table) {
$table->dropColumn('image');
});
Schema::table('components', function (Blueprint $table) {
$table->dropColumn('image');
});
Schema::table('consumables', function (Blueprint $table) {
$table->dropColumn('image');
});
Schema::table('departments', function (Blueprint $table) {
$table->dropColumn('image');
});
Schema::table('locations', function (Blueprint $table) {
$table->dropColumn('image');
});
Schema::table('manufacturers', function (Blueprint $table) {
$table->dropColumn('image');
});
}
}

1
public/uploads/categories/.gitignore vendored Executable file
View file

@ -0,0 +1 @@
!.gitignore

1
public/uploads/companies/.gitignore vendored Executable file
View file

@ -0,0 +1 @@
!.gitignore

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

1
public/uploads/components/.gitignore vendored Executable file
View file

@ -0,0 +1 @@
!.gitignore

1
public/uploads/consumables/.gitignore vendored Executable file
View file

@ -0,0 +1 @@
!.gitignore

1
public/uploads/departments/.gitignore vendored Executable file
View file

@ -0,0 +1 @@
!.gitignore

1
public/uploads/locations/.gitignore vendored Executable file
View file

@ -0,0 +1 @@
!.gitignore

1
public/uploads/manufacturers/.gitignore vendored Executable file
View file

@ -0,0 +1 @@
!.gitignore

View file

@ -89,6 +89,7 @@
'history' => 'History',
'history_for' => 'History for',
'id' => 'ID',
'image' => 'Image',
'image_delete' => 'Delete Image',
'image_upload' => 'Upload Image',
'import' => 'Import',

View file

@ -61,11 +61,33 @@
{{ trans('admin/categories/general.checkin_email') }}
</label>
</div>
<!-- Image -->
@if ($item->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
<img src="{{ url('/') }}/uploads/categories/{{ $item->image }}" />
{!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@stop
@section('content')
@parent
@if ($snipeSettings->default_eula_text!='')
<!-- Modal -->
<div class="modal fade" id="eulaModal" tabindex="-1" role="dialog" aria-labelledby="eulaModalLabel" aria-hidden="true">
@ -85,4 +107,7 @@
</div>
</div>
@endif
@stop

View file

@ -9,4 +9,25 @@
{{-- Page content --}}
@section('inputFields')
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/companies/table.name')])
<!-- Image -->
@if ($item->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
<img src="{{ url('/') }}/uploads/companies/{{ $item->image }}" />
{!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@stop

View file

@ -21,4 +21,24 @@
@include ('partials.forms.edit.purchase_date')
@include ('partials.forms.edit.purchase_cost')
<!-- Image -->
@if ($item->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
<img src="{{ url('/') }}/uploads/components/{{ $item->image }}" />
{!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@stop

View file

@ -71,6 +71,12 @@
<!-- side address column -->
<div class="col-md-3">
@if ($component->image!='')
<div class="col-md-12" style="padding-bottom: 5px;">
<img src="{{ url('/') }}/uploads/components/{{ $component->image }}">
</div>
@endif
@if ($component->serial!='')
<div class="col-md-12" style="padding-bottom: 5px;"><strong>{{ trans('admin/hardware/form.serial') }}: </strong>
{{ $component->serial }} </div>

View file

@ -21,4 +21,23 @@
@include ('partials.forms.edit.quantity')
@include ('partials.forms.edit.minimum_quantity')
<!-- Image -->
@if ($item->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
<img src="{{ url('/') }}/uploads/consumables/{{ $item->image }}" />
{!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@stop

View file

@ -57,6 +57,12 @@
</div> <!-- /.col-md-9-->
<div class="col-md-3">
@if ($consumable->image!='')
<div class="col-md-12" style="padding-bottom: 5px;">
<img src="{{ url('/') }}/uploads/consumables/{{ $consumable->image }}">
</div>
@endif
<h4>{{ trans('admin/consumables/general.about_consumables_title') }}</h4>
<p>{{ trans('admin/consumables/general.about_consumables_text') }} </p>

View file

@ -32,7 +32,25 @@
</div>
</div>
<!-- Image -->
@if ($item->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
<img src="{{ url('/') }}/uploads/departments/{{ $item->image }}" />
{!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@stop

View file

@ -29,8 +29,8 @@
<tr>
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-sortable="true" data-field="company" data-visible="false" data-formatter="companiesLinkObjFormatter">{{ trans('general.company') }}</th>
<th data-sortable="true" data-formatter="departmentsLinkFormatter" data-field="name" data-searchable="false">{{ trans('admin/departments/table.name') }}</th>
<th data-sortable="true" data-field="image" data-visible="false" data-formatter="imageFormatter">{{ trans('general.image') }}</th>
<th data-sortable="false" data-formatter="usersLinkObjFormatter" data-field="manager" data-searchable="false">{{ trans('admin/departments/table.manager') }}</th>
<th data-sortable="false" data-field="users_count" data-searchable="false">{{ trans('general.users') }}</th>
<th data-sortable="false" data-formatter="locationsLinkObjFormatter" data-field="location" data-searchable="false">{{ trans('admin/departments/table.location') }}</th>

View file

@ -58,6 +58,25 @@
</div>
@endif
<!-- Image -->
@if ($item->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
<img src="{{ url('/') }}/uploads/locations/{{ $item->image }}" />
{!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@stop
@if (!$item->id)

View file

@ -29,10 +29,11 @@
<tr>
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-sortable="true" data-formatter="locationsLinkFormatter" data-field="name" data-searchable="true">{{ trans('admin/locations/table.name') }}</th>
<th data-sortable="true" data-field="image" data-visible="false" data-formatter="imageFormatter">{{ trans('general.image') }}</th>
<th data-sortable="true" data-field="parent" data-formatter="locationsLinkObjFormatter">{{ trans('admin/locations/table.parent') }}</th>
<th data-searchable="false" data-sortable="false" data-field="assets_default">{{ trans('admin/locations/table.assets_rtd') }}</th>
<th data-searchable="false" data-sortable="false" data-field="assets_checkedout">{{ trans('admin/locations/table.assets_checkedout') }}</th>
<th data-searchable="true" data-sortable="true" data-field="currency">{{ App\Models\Setting::first()->default_currency }}</th>
<th data-searchable="true" data-sortable="true" data-field="currency">{{ trans('general.currency') }}</th>
<th data-searchable="true" data-sortable="true" data-field="address">{{ trans('admin/locations/table.address') }}</th>
<th data-searchable="true" data-sortable="true" data-field="city">{{ trans('admin/locations/table.city') }}
</th>

View file

@ -50,4 +50,25 @@
</div>
</div>
<!-- Image -->
@if ($item->image)
<div class="form-group {{ $errors->has('image_delete') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image_delete">{{ trans('general.image_delete') }}</label>
<div class="col-md-5">
{{ Form::checkbox('image_delete') }}
<img src="{{ url('/') }}/uploads/manufacturers/{{ $item->image }}" />
{!! $errors->first('image_delete', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@endif
<div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="image">{{ trans('general.image_upload') }}</label>
<div class="col-md-5">
{{ Form::file('image') }}
{!! $errors->first('image', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
@stop

View file

@ -30,7 +30,7 @@
<thead>
<tr>
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('admin/suppliers/table.id') }}</th>
<th data-formatter="imageFormatter" data-sortable="true" data-field="image" data-visible="false" data-searchable="false">Image</th>
<th data-formatter="imageFormatter" data-sortable="true" data-field="image" data-visible="false" data-searchable="false">{{ trans('general.image') }}</th>
<th data-sortable="true" data-field="name" data-formatter="suppliersLinkFormatter">{{ trans('admin/suppliers/table.name') }}</th>
<th data-sortable="true" data-field="address">{{ trans('admin/suppliers/table.address') }}</th>
<th data-searchable="true" data-sortable="true" data-field="contact">{{ trans('admin/suppliers/table.contact') }}</th>