Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update icons to use blade components, standardize button colors and format #15327

Merged
merged 36 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a102c08
Added icon helper
snipe Aug 18, 2024
d2e585b
Added icon blade
snipe Aug 18, 2024
da71f03
Use icon in hardware view
snipe Aug 18, 2024
2b0c67c
Load the icon helper
snipe Aug 18, 2024
9337cba
Added download
snipe Aug 18, 2024
901f4df
Added more icons
snipe Aug 18, 2024
bffba02
Updated icons
snipe Aug 18, 2024
0c09f2b
Moar icon replacement
snipe Aug 18, 2024
4d89049
Added calendar icon for datepickers
snipe Aug 18, 2024
d545537
More icons
snipe Aug 18, 2024
7c9b1f6
Added the plus icon
snipe Aug 18, 2024
803bdb4
Added calendar
snipe Aug 18, 2024
d2e889e
Still more
snipe Aug 18, 2024
7ace932
Added padlock sound
snipe Aug 18, 2024
a77dcad
More links
snipe Aug 18, 2024
ae2f957
And still more
snipe Aug 18, 2024
c700127
Updated user view
snipe Aug 18, 2024
f200960
Aaaand more
snipe Aug 18, 2024
00bc9ac
Fixed spacing
snipe Aug 18, 2024
59725f2
Removed extra debugging in test
snipe Aug 19, 2024
0bc995b
Updated more icons
snipe Aug 19, 2024
b4b6f7a
Added css-consumable to overrides for table headers
snipe Aug 19, 2024
f82266f
Cleaned up presenters
snipe Aug 19, 2024
eb8d43a
Updated buttons on models
snipe Aug 19, 2024
229d8b9
Added location restore
snipe Aug 19, 2024
8d52fa5
Fixed suppliers buttons
snipe Aug 19, 2024
84f14a0
Fixed logging for asset model restore
snipe Aug 19, 2024
479b2b4
More icons
snipe Aug 19, 2024
e048f09
More icons
snipe Aug 19, 2024
6f02484
Few more
snipe Aug 19, 2024
d89c868
Reversed location button ordering
snipe Aug 19, 2024
34cd4b6
Added links to apple/google maps
snipe Aug 19, 2024
08c3a25
Little more padding
snipe Aug 19, 2024
be5f3f3
Settings pages
snipe Aug 19, 2024
5d9f988
Added fw class to topnav icons
snipe Aug 20, 2024
f6319e1
Added fa-fw to sidebar elements
snipe Aug 20, 2024
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
179 changes: 179 additions & 0 deletions app/Helpers/IconHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<?php

namespace App\Helpers;

class IconHelper
{

public static function icon($type) {
switch ($type) {
case 'checkout':
return 'fa-solid fa-rotate-left';
case 'checkin':
return 'fa-solid fa-rotate-right';
case 'edit':
return 'fas fa-pencil-alt';
case 'clone':
return 'far fa-clone';
case 'delete':
return 'fas fa-trash';
case 'create':
return 'fa-solid fa-plus';
case 'audit':
return 'fa-solid fa-clipboard-check';
case '2fa reset':
return 'fa-solid fa-mobile-screen';
case 'new-user':
return 'fa-solid fa-user-plus';
case 'merged-user':
return 'fa-solid fa-people-arrows';
case 'delete-user':
return 'fa-solid fa-user-minus';
case 'update-user':
return 'fa-solid fa-user-pen';
case 'user':
return 'fa-solid fa-user';
case 'users':
return 'fas fa-users';
case 'restore':
return 'fa-solid fa-trash-arrow-up';
case 'external-link':
return 'fa fa-external-link';
case 'email':
return 'fa-regular fa-envelope';
case 'phone':
return 'fa-solid fa-phone';
case 'long-arrow-right':
return 'fas fa-long-arrow-alt-right';
case 'download':
return 'fas fa-download';
case 'checkmark':
return 'fas fa-check icon-white';
case 'x':
return 'fas fa-times';
case 'logout':
return 'fa fa-sign-out';
case 'admin-settings':
return 'fa fa-cogs';
case 'settings':
return 'fa fa-cog';
case 'angle-left':
return 'fa fa-angle-left';
case 'warning':
return 'fas fa-exclamation-triangle';
case 'kits':
return 'fa fa-object-group';
case 'assets':
return 'fas fa-barcode';
case 'accessories':
return 'far fa-keyboard';
case 'components':
return 'far fa-hdd';
case 'consumables':
return 'fas fa-tint';
case 'licenses':
return 'far fa-save';
case 'requestable':
return 'fa fa-laptop';
case 'reports':
return 'fas fa-chart-bar';
case 'heart':
return 'fas fa-heart';
case 'circle':
return 'fa-regular fa-circle';
case 'circle-solid':
return 'fa-solid fa-circle';
case 'due':
return 'fas fa-history';
case 'import':
return 'fas fa-cloud-upload-alt fa-fw';
case 'search':
return 'fas fa-search';
case 'alerts':
return 'far fa-flag';
case 'password':
return 'fa-solid fa-key';
case 'api-key':
return 'fa-solid fa-user-secret';
case 'nav-toggle':
return 'fas fa-bars';
case 'dashboard':
return 'fas fa-tachometer-alt';
case 'info-circle':
return 'fas fa-info-circle';
case 'caret-right':
return 'fa fa-caret-right';
case 'caret-up':
return 'fa fa-caret-up';
case 'caret-down':
return 'fa fa-caret-down';
case 'arrow-circle-right':
return 'fa fa-arrow-circle-right';
case 'minus':
return 'fas fa-minus';
case 'spinner':
return 'fas fa-spinner fa-spin';
case 'copy-clipboard':
return 'fa-regular fa-clipboard';
case 'paperclip':
return 'fas fa-paperclip';
case 'files':
return 'fa-regular fa-file';
case 'more-info':
return 'far fa-life-ring';
case 'calendar':
return 'fas fa-calendar';
case 'plus':
return 'fas fa-plus';
case 'history':
return 'fas fa-history';
case 'more-files':
return 'fa-solid fa-laptop-file';
case 'maintenances':
return 'fas fa-wrench';
case 'seats':
return 'far fa-list-alt';
case 'globe-us':
return 'fas fa-globe-americas';
case 'locked':
return 'fas fa-lock';
case 'unlocked':
return 'fas fa-lock';
case 'locations':
return 'fas fa-map-marker-alt';
case 'superadmin':
return 'fas fa-crown';
case 'print':
return 'fa-solid fa-print';
case 'checkin-and-delete':
return 'fa-solid fa-user-xmark';
case 'branding':
return 'fas fa-copyright';
case 'general-settings':
return 'fa-solid fa-list-check';
case 'groups':
return 'fa-solid fa-user-group';
case 'bell':
return 'fa-solid fa-bell';
case 'hashtag':
return 'fa-solid fa-hashtag';
case 'asset-tags':
return 'fas fa-list-ol';
case 'labels':
return 'fas fa-tags';
case 'ldap':
return 'fas fa-sitemap';
case 'google':
return 'fa-brands fa-google';
case 'saml':
return 'fas fa-sign-in-alt';
case 'backups':
return 'fas fa-file-archive';
case 'logins':
return 'fas fa-crosshairs';
case 'oauth':
return 'fas fa-user-secret';

snipe marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/AssetModelsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function getRestore($id) : RedirectResponse

if ($model->restore()) {
$logaction = new Actionlog();
$logaction->item_type = User::class;
$logaction->item_type = AssetModel::class;
$logaction->item_id = $model->id;
$logaction->created_at = date('Y-m-d H:i:s');
$logaction->user_id = auth()->id();
Expand Down
44 changes: 43 additions & 1 deletion app/Http/Controllers/LocationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers;

use App\Http\Requests\ImageUploadRequest;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\Location;
use App\Models\User;
Expand Down Expand Up @@ -193,7 +194,13 @@ public function destroy($locationId) : RedirectResponse
*/
public function show($id = null) : View | RedirectResponse
{
$location = Location::find($id);
$location = Location::withCount('assignedAssets as assigned_assets_count')
->withCount('assets as assets_count')
->withCount('rtd_assets as rtd_assets_count')
->withCount('children as children_count')
->withCount('users as users_count')
->withTrashed()
->find($id);

if (isset($location->id)) {
return view('locations/view', compact('location'));
Expand Down Expand Up @@ -249,6 +256,41 @@ public function getClone($locationId = null) : View | RedirectResponse
}


/**
* Restore a given Asset Model (mark as un-deleted)
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @param int $id
*/
public function postRestore($id) : RedirectResponse
{
$this->authorize('create', Location::class);

if ($location = Location::withTrashed()->find($id)) {

if ($location->deleted_at == '') {
return redirect()->back()->with('error', trans('general.not_deleted', ['item_type' => trans('general.location')]));
}

if ($location->restore()) {
$logaction = new Actionlog();
$logaction->item_type = Location::class;
$logaction->item_id = $location->id;
$logaction->created_at = date('Y-m-d H:i:s');
$logaction->user_id = auth()->id();
$logaction->logaction('restore');

return redirect()->route('locations.index')->with('success', trans('admin/locations/message.restore.success'));
}

// Check validation
return redirect()->back()->with('error', trans('general.could_not_restore', ['item_type' => trans('general.location'), 'error' => $location->getErrors()->first()]));
}

return redirect()->back()->with('error', trans('admin/models/message.does_not_exist'));

}
public function print_all_assigned($id) : View | RedirectResponse
{
if ($location = Location::where('id', $id)->first()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/AssetPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,6 @@ public function viewUrl()

public function glyph()
{
return '<i class="fas fa-barcode" aria-hidden="true"></i>';
return '<x-icon type="assets" />';
}
}
18 changes: 12 additions & 6 deletions app/Presenters/CompanyPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,40 +65,46 @@ public static function dataTableLayout()
'field' => 'users_count',
'searchable' => false,
'sortable' => true,
'title' => '<span class="hidden-xs"><i class="fas fa-users"></i></span><span class="hidden-md hidden-lg">'.trans('general.users').'</span></th>',
'title' => trans('general.users'),
'visible' => true,
'class' => 'css-users',

], [
'field' => 'assets_count',
'searchable' => false,
'sortable' => true,
'title' => '<span class="hidden-xs"><i class="fas fa-barcode" aria-hidden="true"></i></span><span class="hidden-md hidden-lg">'.trans('general.assets').'</span>',
'title' => trans('general.assets'),
'visible' => true,
'class' => 'css-barcode',

], [
'field' => 'licenses_count',
'searchable' => false,
'sortable' => true,
'title' => trans('general.licenses'),
'visible' => true,
'title' => ' <span class="hidden-xs"><i class="far fa-save"></i></span><span class="hidden-md hidden-lg">'.trans('general.licenses').'</span>',
'class' => 'css-license',
], [
'field' => 'accessories_count',
'searchable' => false,
'sortable' => true,
'title' => trans('general.accessories'),
'visible' => true,
'title' => ' <span class="hidden-xs"><i class="far fa-keyboard"></i></span><span class="hidden-md hidden-lg">'.trans('general.accessories').'</span>',
'class' => 'css-accessory',
], [
'field' => 'consumables_count',
'searchable' => false,
'sortable' => true,
'title' => trans('general.consumables'),
'visible' => true,
'title' => ' <span class="hidden-xs"><i class="fas fa-tint"></i></span><span class="hidden-md hidden-lg">'.trans('general.consumables').'</span>',
'class' => 'css-consumable',
], [
'field' => 'components_count',
'searchable' => false,
'sortable' => true,
'title' => trans('general.components'),
'visible' => true,
'title' => ' <span class="hidden-xs"><i class="far fa-hdd"></i></span><span class="hidden-md hidden-lg">'.trans('general.components').'</span>',
'class' => 'css-component',
], [
'field' => 'updated_at',
'searchable' => false,
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/DepreciationReportPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,6 @@ public function viewUrl()

public function glyph()
{
return '<i class="fas fa-barcode" aria-hidden="true"></i>';
return '<x-icon type="reports" class="text-orange" />';
}
}
2 changes: 1 addition & 1 deletion app/Presenters/LocationPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function viewUrl()

public function glyph()
{
return '<i class="fas fa-map-marker-alt" aria-hidden="true"></i>';
return '<x-icon type="locations" />';
}

public function fullName()
Expand Down
16 changes: 8 additions & 8 deletions app/Presenters/ManufacturerPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,36 +94,36 @@ public static function dataTableLayout()
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => ' <span class="hidden-md hidden-lg">Assets</span>'
.'<span class="hidden-xs"><i class="fas fa-barcode fa-lg"></i></span>',
'title' => trans('general.assets'),
'visible' => true,
'class' => 'css-barcode',
],
[
'field' => 'licenses_count',
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => ' <span class="hidden-md hidden-lg">Licenses</span>'
.'<span class="hidden-xs"><i class="far fa-save fa-lg"></i></span>',
'title' => trans('general.licenses'),
'visible' => true,
'class' => 'css-license',
],
[
'field' => 'consumables_count',
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => ' <span class="hidden-md hidden-lg">Consumables</span>'
.'<span class="hidden-xs"><i class="fas fa-tint fa-lg"></i></span>',
'title' => trans('general.consumables'),
'visible' => true,
'class' => 'css-consumable',
],
[
'field' => 'accessories_count',
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => ' <span class="hidden-md hidden-lg">Accessories</span>'
.'<span class="hidden-xs"><i class="far fa-keyboard fa-lg"></i></span>',
'title' => trans('general.accessories'),
'visible' => true,
'class' => 'css-accessory',
],
[
'field' => 'created_at',
Expand Down
2 changes: 1 addition & 1 deletion app/Presenters/UserPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,6 @@ public function viewUrl()

public function glyph()
{
return '<i class="fas fa-user" aria-hidden="true"></i>';
return '<x-icon type="user"/>';
}
}
4 changes: 3 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@
'Google2FA' => PragmaRX\Google2FALaravel\Facade::class,
'Image' => Intervention\Image\ImageServiceProvider::class,
'Carbon' => Carbon\Carbon::class,
'Helper' => App\Helpers\Helper::class, // makes it much easier to use 'Helper::blah' in blades (which is where we usually use this)
'Helper' => App\Helpers\Helper::class,
// makes it much easier to use 'Helper::blah' in blades (which is where we usually use this)
'Icon' => App\Helpers\IconHelper::class,
'Socialite' => Laravel\Socialite\Facades\Socialite::class,


Expand Down
Loading
Loading