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

fix side menu groups order is not same for other locales #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 1 addition & 1 deletion app/Filament/Pages/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected static function getNavigationLabel(): string

protected static function getNavigationGroup(): ?string
{
return __('Management');
return 'Management';
}

protected function getFormSchema(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Pages/JiraImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected static function getNavigationLabel(): string

protected static function getNavigationGroup(): ?string
{
return __('Settings');
return 'Settings';
}

protected function getFormSchema(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Pages/ManageGeneralSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected static function getNavigationLabel(): string

protected static function getNavigationGroup(): ?string
{
return __('Settings');
return 'Settings';
}

protected function getFormSchema(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Pages/RoadMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected static function getNavigationLabel(): string

protected static function getNavigationGroup(): ?string
{
return __('Management');
return 'Management';
}

public function mount()
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Pages/TimesheetDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected static function getNavigationLabel(): string

protected static function getNavigationGroup(): ?string
{
return __('Timesheet');
return 'Timesheet';
}

protected static function shouldRegisterNavigation(): bool
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Pages/TimesheetExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TimesheetExport extends Page implements HasForms

protected static function getNavigationGroup(): ?string
{
return __('Timesheet');
return 'Timesheet';
}

public function mount(): void
Expand Down
4 changes: 1 addition & 3 deletions app/Filament/Resources/ActivityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\ActivityResource\Pages;
use App\Filament\Resources\ActivityResource\RelationManagers;
use App\Models\Activity;
use Filament\Forms;
use Filament\Resources\Form;
Expand All @@ -18,7 +17,6 @@ class ActivityResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-clipboard';

protected static ?int $navigationSort = 1;

protected static function getNavigationLabel(): string
{
return __('Activities');
Expand All @@ -31,7 +29,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Referential');
return 'Referential';
}

public static function form(Form $form): Form
Expand Down
3 changes: 1 addition & 2 deletions app/Filament/Resources/PermissionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\PermissionResource\Pages;
use App\Filament\Resources\PermissionResource\RelationManagers;
use App\Models\Permission;
use Filament\Forms;
use Filament\Resources\Form;
Expand Down Expand Up @@ -31,7 +30,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return static::getPluralLabel();
return 'Permissions';
}

public static function form(Form $form): Form
Expand Down
3 changes: 2 additions & 1 deletion app/Filament/Resources/ProjectResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Management');
return 'Management';
}


public static function form(Form $form): Form
{
return $form
Expand Down
3 changes: 1 addition & 2 deletions app/Filament/Resources/ProjectStatusResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\ProjectStatusResource\Pages;
use App\Filament\Resources\ProjectStatusResource\RelationManagers;
use App\Models\ProjectStatus;
use Filament\Forms;
use Filament\Resources\Form;
Expand Down Expand Up @@ -31,7 +30,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Referential');
return 'Referential';
}

public static function form(Form $form): Form
Expand Down
3 changes: 1 addition & 2 deletions app/Filament/Resources/RoleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\RoleResource\Pages;
use App\Filament\Resources\RoleResource\RelationManagers;
use App\Models\Permission;
use App\Models\Role;
use Filament\Forms;
Expand Down Expand Up @@ -32,7 +31,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Permissions');
return 'Permissions';
}

public static function form(Form $form): Form
Expand Down
3 changes: 1 addition & 2 deletions app/Filament/Resources/TicketPriorityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\TicketPriorityResource\Pages;
use App\Filament\Resources\TicketPriorityResource\RelationManagers;
use App\Models\TicketPriority;
use Filament\Forms;
use Filament\Resources\Form;
Expand Down Expand Up @@ -34,7 +33,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Referential');
return 'Referential';
}

public static function form(Form $form): Form
Expand Down
3 changes: 1 addition & 2 deletions app/Filament/Resources/TicketResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\TicketResource\Pages;
use App\Filament\Resources\TicketResource\RelationManagers;
use App\Models\Epic;
use App\Models\Project;
use App\Models\Ticket;
Expand Down Expand Up @@ -41,7 +40,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Management');
return 'Management';
}

public static function form(Form $form): Form
Expand Down
3 changes: 1 addition & 2 deletions app/Filament/Resources/TicketStatusResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\TicketStatusResource\Pages;
use App\Filament\Resources\TicketStatusResource\RelationManagers;
use App\Models\TicketStatus;
use Filament\Forms;
use Filament\Resources\Form;
Expand Down Expand Up @@ -31,7 +30,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Referential');
return 'Referential';
}

public static function form(Form $form): Form
Expand Down
3 changes: 1 addition & 2 deletions app/Filament/Resources/TicketTypeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\TicketTypeResource\Pages;
use App\Filament\Resources\TicketTypeResource\RelationManagers;
use App\Models\TicketType;
use Filament\Forms;
use Filament\Resources\Form;
Expand Down Expand Up @@ -33,7 +32,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Referential');
return 'Referential';
}

public static function form(Form $form): Form
Expand Down
3 changes: 1 addition & 2 deletions app/Filament/Resources/TimesheetResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources;

use App\Filament\Resources\TimesheetResource\Pages;
use App\Filament\Resources\TimesheetResource\RelationManagers;
use App\Models\Activity;
use App\Models\TicketHour;
use Filament\Forms;
Expand Down Expand Up @@ -35,7 +34,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Timesheet');
return 'Timesheet';
}

protected static function shouldRegisterNavigation(): bool
Expand Down
5 changes: 1 addition & 4 deletions app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace App\Filament\Resources;

use App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource\RelationManagers;
use App\Models\User;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Pages\CreateRecord;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Support\HtmlString;

class UserResource extends Resource
{
Expand All @@ -33,7 +30,7 @@ public static function getPluralLabel(): ?string

protected static function getNavigationGroup(): ?string
{
return __('Permissions');
return 'Permissions';
}

public static function form(Form $form): Form
Expand Down
19 changes: 11 additions & 8 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Settings\GeneralSettings;
use Filament\Facades\Filament;
use Filament\Navigation\NavigationGroup;
use Illuminate\Database\QueryException;
use Illuminate\Foundation\Vite;
use Illuminate\Support\Facades\Config;
Expand Down Expand Up @@ -38,6 +39,16 @@ public function boot()
Filament::registerTheme(
app(Vite::class)('resources/css/filament.scss'),
);

// Register navigation groups
Filament::registerNavigationGroups([
'Management' => NavigationGroup::make()->label(__('Management')),
'Referential' => NavigationGroup::make()->label( __('Referential')),
'Security' => NavigationGroup::make()->label(__('Security')),
'Settings' => NavigationGroup::make()->label(__('Settings')),
'Permissions' => NavigationGroup::make()->label(__('Permissions')),
'Timesheet' => NavigationGroup::make()->label(__('Timesheet')),
]);
});

// Register tippy styles
Expand All @@ -61,14 +72,6 @@ public function boot()
href="' . config('app.logo') . '">'),
]);

// Register navigation groups
Filament::registerNavigationGroups([
__('Management'),
__('Referential'),
__('Security'),
__('Settings'),
]);

// Force HTTPS over HTTP
if (env('APP_FORCE_HTTPS') ?? false) {
URL::forceScheme('https');
Expand Down
2 changes: 1 addition & 1 deletion config/filament.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
LocaleMiddleware::class,
DispatchServingFilamentEvent::class,
MirrorConfigToSubpackages::class,
LocaleMiddleware::class
],
],

Expand Down