Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Http/Controllers/Api/CategoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function index(Request $request) : array
'created_at',
'updated_at',
'image',
'tag_color',
'notes',
];

Expand All @@ -57,6 +58,7 @@ public function index(Request $request) : array
'require_acceptance',
'checkin_email',
'image',
'tag_color',
'notes',
])
->with('adminuser')
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Controllers/Api/CompaniesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function index(Request $request) : JsonResponse | array
'accessories_count',
'consumables_count',
'components_count',
'tag_color',
'notes',
];

Expand All @@ -64,6 +65,11 @@ public function index(Request $request) : JsonResponse | array
$companies->where('created_by', '=', $request->input('created_by'));
}

if ($request->filled('tag_color')) {
$companies->where('tag_color', '=', $request->input('tag_color'));
}



// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $companies->count()) ? $companies->count() : app('api_offset_value');
Expand Down Expand Up @@ -191,6 +197,7 @@ public function selectlist(Request $request) : array
'companies.name',
'companies.email',
'companies.image',
'companies.tag_color',
]);


Expand Down
8 changes: 7 additions & 1 deletion app/Http/Controllers/Api/DepartmentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DepartmentsController extends Controller
public function index(Request $request) : JsonResponse | array
{
$this->authorize('view', Department::class);
$allowed_columns = ['id', 'name', 'image', 'users_count', 'notes'];
$allowed_columns = ['id', 'name', 'image', 'users_count', 'notes', 'tag_color'];

$departments = Department::select(
[
Expand All @@ -38,6 +38,7 @@ public function index(Request $request) : JsonResponse | array
'departments.created_at',
'departments.updated_at',
'departments.image',
'departments.tag_color',
'departments.notes'
])->with('users')->with('location')->with('manager')->with('company')->withCount('users as users_count');

Expand All @@ -61,6 +62,10 @@ public function index(Request $request) : JsonResponse | array
$departments->where('location_id', '=', $request->input('location_id'));
}

if ($request->filled('tag_color')) {
$departments->where('tag_color', '=', $request->input('departments.tag_color'));
}

// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $departments->count()) ? $departments->count() : app('api_offset_value');
$limit = app('api_limit_value');
Expand Down Expand Up @@ -186,6 +191,7 @@ public function selectlist(Request $request) : array
'id',
'name',
'image',
'tag_color',
]);

if ($request->filled('search')) {
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Controllers/Api/LocationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function index(Request $request) : JsonResponse | array
'state',
'updated_at',
'zip',
'tag_color',
'notes',
];

Expand All @@ -81,6 +82,8 @@ public function index(Request $request) : JsonResponse | array
'locations.ldap_ou',
'locations.currency',
'locations.company_id',
'locations.tag_color',
'locations.tag_color',
'locations.notes',
'locations.created_by',
'locations.deleted_at',
Expand Down Expand Up @@ -145,6 +148,10 @@ public function index(Request $request) : JsonResponse | array
$locations->onlyTrashed();
}

if ($request->filled('tag_color')) {
$locations->where('tag_color', '=', $request->input('locations.tag_color'));
}

// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $locations->count()) ? $locations->count() : app('api_offset_value');
$limit = app('api_limit_value');
Expand Down Expand Up @@ -402,6 +409,7 @@ public function selectlist(Request $request) : array
'locations.name',
'locations.parent_id',
'locations.image',
'locations.tag_color',
]);

// Only scope locations if the setting is enabled
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Controllers/Api/ManufacturersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function index(Request $request) : JsonResponse | array
'consumables_count',
'components_count',
'licenses_count',
'tag_color',
'notes',
];

Expand All @@ -63,6 +64,7 @@ public function index(Request $request) : JsonResponse | array
'updated_at',
'image',
'deleted_at',
'tag_color',
'notes',
])
->with('adminuser')
Expand Down Expand Up @@ -104,6 +106,10 @@ public function index(Request $request) : JsonResponse | array
$manufacturers->where('support_email', '=', $request->input('support_email'));
}

if ($request->filled('tag_color')) {
$manufacturers->where('tag_color', '=', $request->input('manufacturers.tag_color'));
}

// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $manufacturers->count()) ? $manufacturers->count() : app('api_offset_value');
$limit = app('api_limit_value');
Expand Down Expand Up @@ -258,6 +264,7 @@ public function selectlist(Request $request) : array
'id',
'name',
'image',
'tag_color',
]);

if ($request->filled('search')) {
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Api/SuppliersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ public function index(Request $request): array
'accessories_count',
'components_count',
'consumables_count',
'tag_color',
'url',
'notes',
];

$suppliers = Supplier::select(
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'created_by', 'updated_at', 'deleted_at', 'image', 'notes', 'url', 'zip'])
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'created_by', 'updated_at', 'deleted_at', 'image', 'notes', 'url', 'zip', 'tag_color'])
->withCount('assets as assets_count')
->withCount('licenses as licenses_count')
->withCount('accessories as accessories_count')
Expand Down Expand Up @@ -251,6 +252,7 @@ public function selectlist(Request $request) : array
'id',
'name',
'image',
'tag_color',
]);

if ($request->filled('search')) {
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/CategoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function store(ImageUploadRequest $request) : RedirectResponse
$category->require_acceptance = $request->input('require_acceptance', '0');
$category->alert_on_response = $request->input('alert_on_response', '0');
$category->checkin_email = $request->input('checkin_email', '0');
$category->tag_color = $request->input('tag_color');
$category->notes = $request->input('notes');
$category->created_by = auth()->id();

Expand Down Expand Up @@ -132,6 +133,7 @@ public function update(ImageUploadRequest $request, Category $category) : Redire
$category->require_acceptance = $request->input('require_acceptance', '0');
$category->alert_on_response = $request->input('alert_on_response', '0');
$category->checkin_email = $request->input('checkin_email', '0');
$category->tag_color = $request->input('tag_color');
$category->notes = $request->input('notes');

$category = $request->handleImages($category);
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/CompaniesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function store(ImageUploadRequest $request) : RedirectResponse
$company->phone = $request->input('phone');
$company->fax = $request->input('fax');
$company->email = $request->input('email');
$company->tag_color = $request->input('tag_color');
$company->notes = $request->input('notes');
$company->created_by = auth()->id();

Expand Down Expand Up @@ -102,6 +103,7 @@ public function update(ImageUploadRequest $request, Company $company) : Redirect
$company->phone = $request->input('phone');
$company->fax = $request->input('fax');
$company->email = $request->input('email');
$company->tag_color = $request->input('tag_color');
$company->notes = $request->input('notes');

$company = $request->handleImages($company);
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/DepartmentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function store(ImageUploadRequest $request) : RedirectResponse
$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->tag_color = $request->input('tag_color');
$department->notes = $request->input('notes');
$department = $request->handleImages($department);

Expand Down Expand Up @@ -157,6 +158,7 @@ public function update(ImageUploadRequest $request, Department $department) : Re
$department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null);
$department->phone = $request->input('phone');
$department->fax = $request->input('fax');
$department->tag_color = $request->input('tag_color');
$department->notes = $request->input('notes');
$department = $request->handleImages($department);

Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/LocationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function store(ImageUploadRequest $request) : RedirectResponse
$location->created_by = auth()->id();
$location->phone = request('phone');
$location->fax = request('fax');
$location->tag_color = $request->input('tag_color');
$location->notes = $request->input('notes');
$location->company_id = Company::getIdForCurrentUser($request->input('company_id'));

Expand Down Expand Up @@ -156,6 +157,7 @@ public function update(ImageUploadRequest $request, Location $location) : Redire
$location->fax = request('fax');
$location->ldap_ou = $request->input('ldap_ou');
$location->manager_id = $request->input('manager_id');
$location->tag_color = $request->input('tag_color');
$location->notes = $request->input('notes');

// Only scope the location if the setting is enabled
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/ManufacturersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public function store(ImageUploadRequest $request) : RedirectResponse
$manufacturer->support_email = $request->input('support_email');
$manufacturer->notes = $request->input('notes');
$manufacturer = $request->handleImages($manufacturer);
$manufacturer->tag_color = $request->input('tag_color');

if ($manufacturer->save()) {
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.create.success'));
Expand Down Expand Up @@ -142,6 +143,7 @@ public function update(ImageUploadRequest $request, Manufacturer $manufacturer)
$manufacturer->warranty_lookup_url = $request->input('warranty_lookup_url');
$manufacturer->support_phone = $request->input('support_phone');
$manufacturer->support_email = $request->input('support_email');
$manufacturer->tag_color = $request->input('tag_color');
$manufacturer->notes = $request->input('notes');

// Set the model's image property to null if the image is being deleted
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/SuppliersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function store(ImageUploadRequest $request) : RedirectResponse
$supplier->phone = request('phone');
$supplier->fax = request('fax');
$supplier->email = request('email');
$supplier->tag_color = $request->input('tag_color');
$supplier->notes = request('notes');
$supplier->url = $supplier->addhttp(request('url'));
$supplier->created_by = auth()->id();
Expand Down Expand Up @@ -111,6 +112,7 @@ public function update(ImageUploadRequest $request, Supplier $supplier) : Redire
$supplier->fax = request('fax');
$supplier->email = request('email');
$supplier->url = $supplier->addhttp(request('url'));
$supplier->tag_color = $request->input('tag_color');
$supplier->notes = request('notes');
$supplier = $request->handleImages($supplier);

Expand Down
30 changes: 25 additions & 5 deletions app/Http/Transformers/AccessoriesTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,32 @@ public function transformAccessory(Accessory $accessory)
'id' => $accessory->id,
'name' => e($accessory->name),
'image' => ($accessory->image) ? Storage::disk('public')->url('accessories/'.e($accessory->image)) : null,
'company' => ($accessory->company) ? ['id' => $accessory->company->id, 'name'=> e($accessory->company->name)] : null,
'manufacturer' => ($accessory->manufacturer) ? ['id' => $accessory->manufacturer->id, 'name'=> e($accessory->manufacturer->name)] : null,
'supplier' => ($accessory->supplier) ? ['id' => $accessory->supplier->id, 'name'=> e($accessory->supplier->name)] : null,
'company' => ($accessory->company) ? [
'id' => $accessory->company->id,
'name'=> e($accessory->company->name),
'tag_color'=> ($accessory->company->tag_color) ? e($accessory->company->tag_color) : null,
] : null,
'manufacturer' => ($accessory->manufacturer) ? [
'id' => $accessory->manufacturer->id,
'name'=> e($accessory->manufacturer->name),
'tag_color'=> ($accessory->manufacturer->tag_color) ? e($accessory->manufacturer->tag_color) : null,
] : null,
'supplier' => ($accessory->supplier) ? [
'id' => $accessory->supplier->id,
'name'=> e($accessory->supplier->name),
'tag_color'=> ($accessory->supplier->tag_color) ? e($accessory->supplier->tag_color) : null,
] : null,
'model_number' => ($accessory->model_number) ? e($accessory->model_number) : null,
'category' => ($accessory->category) ? ['id' => $accessory->category->id, 'name'=> e($accessory->category->name)] : null,
'location' => ($accessory->location) ? ['id' => $accessory->location->id, 'name'=> e($accessory->location->name)] : null,
'category' => ($accessory->category) ? [
'id' => $accessory->category->id,
'name'=> e($accessory->category->name),
'tag_color'=> ($accessory->category->tag_color) ? e($accessory->category->tag_color) : null,
] : null,
'location' => ($accessory->location) ? [
'id' => $accessory->location->id,
'name'=> e($accessory->location->name),
'tag_color'=> ($accessory->location->tag_color) ? e($accessory->location->tag_color) : null,
] : null,
'notes' => ($accessory->notes) ? Helper::parseEscapedMarkedownInline($accessory->notes) : null,
'qty' => ($accessory->qty) ? (int) $accessory->qty : null,
'purchase_date' => ($accessory->purchase_date) ? Helper::getFormattedDateObject($accessory->purchase_date, 'date') : null,
Expand Down
1 change: 1 addition & 0 deletions app/Http/Transformers/ActionlogsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public function transformActionlog (Actionlog $actionlog, $settings = null)
'location' => ($actionlog->location) ? [
'id' => (int) $actionlog->location->id,
'name' => e($actionlog->location->name),
'tag_color'=> ($actionlog->location->tag_color) ? e($actionlog->location->tag_color) : null,
] : null,
'created_at' => Helper::getFormattedDateObject($actionlog->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($actionlog->updated_at, 'datetime'),
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Transformers/AssetModelsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function transformAssetModel(AssetModel $assetmodel)
'manufacturer' => ($assetmodel->manufacturer) ? [
'id' => (int) $assetmodel->manufacturer->id,
'name'=> e($assetmodel->manufacturer->name),
'tag_color'=> ($assetmodel->manufacturer->tag_color) ? e($assetmodel->manufacturer->tag_color) : null,
] : null,
'image' => ($assetmodel->image != '') ? Storage::disk('public')->url('models/'.e($assetmodel->image)) : null,
'model_number' => ($assetmodel->model_number ? e($assetmodel->model_number): null),
Expand All @@ -60,6 +61,7 @@ public function transformAssetModel(AssetModel $assetmodel)
'category' => ($assetmodel->category) ? [
'id' => (int) $assetmodel->category->id,
'name'=> e($assetmodel->category->name),
'tag_color'=> ($assetmodel->category->tag_color) ? e($assetmodel->category->tag_color) : null,
] : null,
'fieldset' => ($assetmodel->fieldset) ? [
'id' => (int) $assetmodel->fieldset->id,
Expand Down
Loading
Loading