mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Added phone, fax to departments, locations, companies
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
2faa73f983
commit
14c61e4c17
|
@ -27,6 +27,8 @@ class CompaniesController extends Controller
|
|||
$allowed_columns = [
|
||||
'id',
|
||||
'name',
|
||||
'phone',
|
||||
'fax',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'users_count',
|
||||
|
|
|
@ -30,6 +30,8 @@ class DepartmentsController extends Controller
|
|||
$departments = Company::scopeCompanyables(Department::select(
|
||||
'departments.id',
|
||||
'departments.name',
|
||||
'departments.phone',
|
||||
'departments.fax',
|
||||
'departments.location_id',
|
||||
'departments.company_id',
|
||||
'departments.manager_id',
|
||||
|
|
|
@ -37,6 +37,8 @@ class LocationsController extends Controller
|
|||
'locations.city',
|
||||
'locations.state',
|
||||
'locations.zip',
|
||||
'locations.phone',
|
||||
'locations.fax',
|
||||
'locations.country',
|
||||
'locations.parent_id',
|
||||
'locations.manager_id',
|
||||
|
|
|
@ -60,6 +60,8 @@ final class CompaniesController extends Controller
|
|||
|
||||
$company = new Company;
|
||||
$company->name = $request->input('name');
|
||||
$company->phone = $request->input('phone');
|
||||
$company->fax = $request->input('fax');
|
||||
|
||||
$company = $request->handleImages($company);
|
||||
|
||||
|
@ -111,6 +113,8 @@ final class CompaniesController extends Controller
|
|||
$this->authorize('update', $company);
|
||||
|
||||
$company->name = $request->input('name');
|
||||
$company->phone = $request->input('phone');
|
||||
$company->fax = $request->input('fax');
|
||||
|
||||
$company = $request->handleImages($company);
|
||||
|
||||
|
|
|
@ -170,6 +170,8 @@ class DepartmentsController extends Controller
|
|||
$department->manager_id = ($request->filled('manager_id') ? $request->input('manager_id') : null);
|
||||
$department->location_id = ($request->filled('location_id') ? $request->input('location_id') : null);
|
||||
$department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null);
|
||||
$department->phone = $request->input('phone');
|
||||
$department->fax = $request->input('fax');
|
||||
|
||||
$department = $request->handleImages($department);
|
||||
|
||||
|
|
|
@ -79,6 +79,8 @@ class LocationsController extends Controller
|
|||
$location->ldap_ou = $request->input('ldap_ou');
|
||||
$location->manager_id = $request->input('manager_id');
|
||||
$location->user_id = Auth::id();
|
||||
$location->phone = request('phone');
|
||||
$location->fax = request('fax');
|
||||
|
||||
$location = $request->handleImages($location);
|
||||
|
||||
|
@ -139,6 +141,8 @@ class LocationsController extends Controller
|
|||
$location->state = $request->input('state');
|
||||
$location->country = $request->input('country');
|
||||
$location->zip = $request->input('zip');
|
||||
$location->phone = request('phone');
|
||||
$location->fax = request('fax');
|
||||
$location->ldap_ou = $request->input('ldap_ou');
|
||||
$location->manager_id = $request->input('manager_id');
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ class CompaniesTransformer
|
|||
$array = [
|
||||
'id' => (int) $company->id,
|
||||
'name' => e($company->name),
|
||||
'phone' => ($company->phone!='') ? e($company->phone): null,
|
||||
'fax' => ($company->phone!='') ? e($company->fax): null,
|
||||
'image' => ($company->image) ? Storage::disk('public')->url('companies/'.e($company->image)) : null,
|
||||
'created_at' => Helper::getFormattedDateObject($company->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($company->updated_at, 'datetime'),
|
||||
|
|
|
@ -26,6 +26,8 @@ class DepartmentsTransformer
|
|||
$array = [
|
||||
'id' => (int) $department->id,
|
||||
'name' => e($department->name),
|
||||
'phone' => ($department->phone!='') ? e($department->phone): null,
|
||||
'fax' => ($department->phone!='') ? e($department->fax): null,
|
||||
'image' => ($department->image) ? Storage::disk('public')->url(app('departments_upload_url').e($department->image)) : null,
|
||||
'company' => ($department->company) ? [
|
||||
'id' => (int) $department->company->id,
|
||||
|
|
|
@ -43,6 +43,8 @@ class LocationsTransformer
|
|||
'state' => ($location->state) ? e($location->state) : null,
|
||||
'country' => ($location->country) ? e($location->country) : null,
|
||||
'zip' => ($location->zip) ? e($location->zip) : null,
|
||||
'phone' => ($location->phone!='') ? e($location->phone): null,
|
||||
'fax' => ($location->phone!='') ? e($location->fax): null,
|
||||
'assigned_assets_count' => (int) $location->assigned_assets_count,
|
||||
'assets_count' => (int) $location->assets_count,
|
||||
'rtd_assets_count' => (int) $location->rtd_assets_count,
|
||||
|
|
|
@ -45,7 +45,7 @@ final class Company extends SnipeModel
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchableAttributes = ['name', 'created_at', 'updated_at'];
|
||||
protected $searchableAttributes = ['name', 'phone', 'fax', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The relations and their attributes that should be included when searching the model.
|
||||
|
@ -59,7 +59,11 @@ final class Company extends SnipeModel
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name'];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'phone',
|
||||
'fax',
|
||||
];
|
||||
|
||||
private static function isFullMultipleCompanySupportEnabled()
|
||||
{
|
||||
|
|
|
@ -43,6 +43,8 @@ class Department extends SnipeModel
|
|||
protected $fillable = [
|
||||
'user_id',
|
||||
'name',
|
||||
'phone',
|
||||
'fax',
|
||||
'location_id',
|
||||
'company_id',
|
||||
'manager_id',
|
||||
|
@ -56,7 +58,7 @@ class Department extends SnipeModel
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchableAttributes = ['name', 'notes'];
|
||||
protected $searchableAttributes = ['name', 'notes', 'phone', 'fax'];
|
||||
|
||||
/**
|
||||
* The relations and their attributes that should be included when searching the model.
|
||||
|
|
|
@ -66,6 +66,8 @@ class Location extends SnipeModel
|
|||
'state',
|
||||
'country',
|
||||
'zip',
|
||||
'phone',
|
||||
'fax',
|
||||
'ldap_ou',
|
||||
'currency',
|
||||
'manager_id',
|
||||
|
@ -80,7 +82,7 @@ class Location extends SnipeModel
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchableAttributes = ['name', 'address', 'city', 'state', 'zip', 'created_at', 'ldap_ou'];
|
||||
protected $searchableAttributes = ['name', 'address', 'city', 'state', 'zip', 'created_at', 'ldap_ou', 'phone', 'fax'];
|
||||
|
||||
/**
|
||||
* The relations and their attributes that should be included when searching the model.
|
||||
|
|
|
@ -29,6 +29,22 @@ class CompanyPresenter extends Presenter
|
|||
'title' => trans('admin/companies/table.name'),
|
||||
'visible' => true,
|
||||
'formatter' => 'companiesLinkFormatter',
|
||||
], [
|
||||
'field' => 'phone',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/users/table.phone'),
|
||||
'visible' => false,
|
||||
'formatter' => 'phoneFormatter',
|
||||
], [
|
||||
'field' => 'fax',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/suppliers/table.phone'),
|
||||
'visible' => false,
|
||||
'formatter' => 'phoneFormatter',
|
||||
], [
|
||||
'field' => 'image',
|
||||
'searchable' => false,
|
||||
|
|
|
@ -141,6 +141,24 @@ class LocationPresenter extends Presenter
|
|||
'title' => trans('admin/locations/table.country'),
|
||||
'visible' => false,
|
||||
],
|
||||
[
|
||||
'field' => 'phone',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/users/table.phone'),
|
||||
'visible' => false,
|
||||
'formatter' => 'phoneFormatter',
|
||||
],
|
||||
[
|
||||
'field' => 'fax',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/suppliers/table.fax'),
|
||||
'visible' => false,
|
||||
'formatter' => 'phoneFormatter',
|
||||
],
|
||||
[
|
||||
'field' => 'ldap_ou',
|
||||
'searchable' => true,
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPhoneFaxToLocations extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('locations', function (Blueprint $table) {
|
||||
$table->string('phone', 20)->after('zip')->nullable()->default(null);
|
||||
$table->string('fax', 20)->after('zip')->nullable()->default(null);
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->string('phone', 20)->after('name')->nullable()->default(null);
|
||||
$table->string('fax', 20)->after('name')->nullable()->default(null);
|
||||
});
|
||||
|
||||
Schema::table('departments', function (Blueprint $table) {
|
||||
$table->string('phone', 20)->after('name')->nullable()->default(null);
|
||||
$table->string('fax', 20)->after('name')->nullable()->default(null);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('locations', function (Blueprint $table) {
|
||||
$table->dropColumn('phone');
|
||||
$table->dropColumn('fax');
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->dropColumn('phone');
|
||||
$table->dropColumn('fax');
|
||||
});
|
||||
|
||||
Schema::table('departments', function (Blueprint $table) {
|
||||
$table->dropColumn('phone');
|
||||
$table->dropColumn('fax');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -9,6 +9,8 @@
|
|||
{{-- Page content --}}
|
||||
@section('inputFields')
|
||||
@include ('partials.forms.edit.name', ['translated_name' => trans('admin/companies/table.name')])
|
||||
@include ('partials.forms.edit.phone')
|
||||
@include ('partials.forms.edit.fax')
|
||||
@include ('partials.forms.edit.image-upload', ['image_path' => app('companies_upload_path')])
|
||||
|
||||
@stop
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
<input id="hidden_company_id" type="hidden" name="company_id" value="{{ Auth::user()->company_id }}">
|
||||
@endif
|
||||
|
||||
@include ('partials.forms.edit.phone')
|
||||
@include ('partials.forms.edit.fax')
|
||||
|
||||
<!-- Manager -->
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
<!-- Manager-->
|
||||
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])
|
||||
|
||||
@include ('partials.forms.edit.phone')
|
||||
@include ('partials.forms.edit.fax')
|
||||
|
||||
<!-- Currency -->
|
||||
<div class="form-group {{ $errors->has('currency') ? ' has-error' : '' }}">
|
||||
<label for="currency" class="col-md-3 control-label">
|
||||
|
|
7
resources/views/partials/forms/edit/fax.blade.php
Normal file
7
resources/views/partials/forms/edit/fax.blade.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<div class="form-group {{ $errors->has('fax') ? ' has-error' : '' }}">
|
||||
{{ Form::label('fax', trans('admin/suppliers/table.fax'), array('class' => 'col-md-3 control-label')) }}
|
||||
<div class="col-md-7">
|
||||
{{Form::text('fax', old('fax', $item->fax), array('class' => 'form-control')) }}
|
||||
{!! $errors->first('fax', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
|
@ -22,15 +22,7 @@
|
|||
</div>
|
||||
|
||||
@include ('partials.forms.edit.phone')
|
||||
|
||||
<div class="form-group {{ $errors->has('fax') ? ' has-error' : '' }}">
|
||||
{{ Form::label('fax', trans('admin/suppliers/table.fax'), array('class' => 'col-md-3 control-label')) }}
|
||||
<div class="col-md-7">
|
||||
{{Form::text('fax', old('fax', $item->fax), array('class' => 'form-control')) }}
|
||||
{!! $errors->first('fax', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include ('partials.forms.edit.fax')
|
||||
@include ('partials.forms.edit.email')
|
||||
|
||||
<div class="form-group {{ $errors->has('url') ? ' has-error' : '' }}">
|
||||
|
|
Loading…
Reference in a new issue