Skip to content

Commit

Permalink
init admin panel
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Dec 14, 2023
1 parent 30fe30e commit 830f6a0
Show file tree
Hide file tree
Showing 27 changed files with 172 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Filament\Pages\Auth;
namespace App\Filament\Organizations\Pages\Auth;

use Filament\Pages\Auth\Login as BaseLogin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Filament\Pages;
namespace App\Filament\Organizations\Pages;

use Filament\Pages\Dashboard as BaseDashboard;
use Illuminate\Contracts\Support\Htmlable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Filament\Pages\Profile;
namespace App\Filament\Organizations\Pages\Profile;

use Filament\Facades\Filament;
use Filament\Forms\Components\Group;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Filament\Pages\Tenancy;
namespace App\Filament\Organizations\Pages\Tenancy;

use App\Forms\Components\Location;
use App\Rules\ValidCIF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources;
namespace App\Filament\Organizations\Resources;

use App\Filament\Resources\BeneficiaryResource\Pages;
use App\Filament\Organizations\Resources\BeneficiaryResource\Pages;
use App\Models\Beneficiary;
use Filament\Resources\Resource;
use Filament\Tables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources\BeneficiaryResource\Pages;
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages;

use App\Filament\Resources\BeneficiaryResource;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Rules\ValidCNP;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Grid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace App\Filament\Resources\BeneficiaryResource\Pages;
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages;

use alcea\cnp\Cnp;
use App\Enums\CivilStatus;
use App\Enums\Gender;
use App\Enums\IDType;
use App\Filament\Resources\BeneficiaryResource;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Forms\Components\Location;
use App\Forms\Components\Spacer;
use App\Rules\ValidCNP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources\BeneficiaryResource\Pages;
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages;

use App\Filament\Resources\BeneficiaryResource;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources\BeneficiaryResource\Pages;
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages;

use App\Filament\Resources\BeneficiaryResource;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Infolists\Components\EnumEntry;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources;
namespace App\Filament\Organizations\Resources;

use App\Filament\Resources\CommunityProfileResource\Pages;
use App\Filament\Organizations\Resources\CommunityProfileResource\Pages;
use App\Models\CommunityProfile;
use Filament\Infolists\Components\Grid;
use Filament\Infolists\Components\Section;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources\CommunityProfileResource\Pages;
namespace App\Filament\Organizations\Resources\CommunityProfileResource\Pages;

use App\Filament\Resources\CommunityProfileResource;
use App\Filament\Organizations\Resources\CommunityProfileResource;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources\CommunityProfileResource\Pages;
namespace App\Filament\Organizations\Resources\CommunityProfileResource\Pages;

use App\Filament\Resources\CommunityProfileResource;
use App\Filament\Organizations\Resources\CommunityProfileResource;
use Filament\Resources\Pages\ListRecords;

class ListCommunityProfiles extends ListRecords
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources\CommunityProfileResource\Pages;
namespace App\Filament\Organizations\Resources\CommunityProfileResource\Pages;

use App\Filament\Resources\CommunityProfileResource;
use App\Filament\Organizations\Resources\CommunityProfileResource;
use Filament\Resources\Pages\ViewRecord;

class ViewCommunityProfile extends ViewRecord
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources;
namespace App\Filament\Organizations\Resources;

use App\Filament\Resources\ServiceResource\Pages;
use App\Filament\Organizations\Resources\ServiceResource\Pages;
use App\Models\Service;
use Filament\Forms\Form;
use Filament\Resources\Resource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

namespace App\Filament\Resources\ServiceResource\Pages;
declare(strict_types=1);

use App\Filament\Resources\ServiceResource;
namespace App\Filament\Organizations\Resources\ServiceResource\Pages;

use App\Filament\Organizations\Resources\ServiceResource;
use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Filament\Resources;
namespace App\Filament\Organizations\Resources;

use App\Filament\Resources\UserResource\Pages;
use App\Filament\Organizations\Resources\UserResource\Pages;
use App\Models\User;
use Filament\Forms\Form;
use Filament\Resources\Resource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace App\Filament\Resources\UserResource\Pages;
declare(strict_types=1);

use App\Filament\Resources\UserResource;
use Filament\Actions;
namespace App\Filament\Organizations\Resources\UserResource\Pages;

use App\Filament\Organizations\Resources\UserResource;
use Filament\Resources\Pages\CreateRecord;

class CreateUser extends CreateRecord
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

namespace App\Filament\Resources\UserResource\Pages;
declare(strict_types=1);

use App\Filament\Resources\UserResource;
namespace App\Filament\Organizations\Resources\UserResource\Pages;

use App\Filament\Organizations\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

namespace App\Filament\Resources\UserResource\Pages;
declare(strict_types=1);

use App\Filament\Resources\UserResource;
namespace App\Filament\Organizations\Resources\UserResource\Pages;

use App\Filament\Organizations\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Filament\Widgets\Organizations;
namespace App\Filament\Organizations\Widgets;

use App\Models\Beneficiary;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
Expand Down
108 changes: 108 additions & 0 deletions app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?php

declare(strict_types=1);

namespace App\Providers\Filament;

use Filament\Forms\Components\DateTimePicker;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Infolists\Infolist;
use Filament\Pages;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Tables\Table;
use Filament\Widgets;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;

class AdminPanelProvider extends PanelProvider
{
public static string $defaultDateDisplayFormat = 'd.m.Y';

public static string $defaultDateTimeDisplayFormat = 'd.m.Y H:i';

public static string $defaultDateTimeWithSecondsDisplayFormat = 'd.m.Y H:i:s';

public static string $defaultTimeDisplayFormat = 'H:i';

public static string $defaultTimeWithSecondsDisplayFormat = 'H:i:s';

public function register(): void
{
parent::register();

$this->setDefaultDateTimeDisplayFormats();
}

public function panel(Panel $panel): Panel
{
return $panel
->id('admin')
->path('admin')
->colors([
'primary' => Color::Red,
])
->maxContentWidth('full')
->viteTheme('resources/css/filament/common/theme.css')
->brandLogo(fn () => view('filament.brand'))
->brandLogoHeight('3rem')
->discoverResources(
in: app_path('Filament/Admin/Resources'),
for: 'App\\Filament\\Admin\\Resources'
)
->discoverPages(
in: app_path('Filament/Admin/Pages'),
for: 'App\\Filament\\Admin\\Pages'
)
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(
in: app_path('Filament/Admin/Widgets'),
for: 'App\\Filament\\Admin\\Widgets'
)
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}

protected function setDefaultDateTimeDisplayFormats(): void
{
Table::$defaultDateDisplayFormat = static::$defaultDateDisplayFormat;
Table::$defaultDateTimeDisplayFormat = static::$defaultDateTimeDisplayFormat;
Table::$defaultTimeDisplayFormat = static::$defaultTimeDisplayFormat;

Infolist::$defaultDateDisplayFormat = static::$defaultDateDisplayFormat;
Infolist::$defaultDateTimeDisplayFormat = static::$defaultDateTimeDisplayFormat;
Infolist::$defaultTimeDisplayFormat = static::$defaultTimeDisplayFormat;

DateTimePicker::$defaultDateDisplayFormat = static::$defaultDateDisplayFormat;
DateTimePicker::$defaultDateTimeDisplayFormat = static::$defaultDateTimeDisplayFormat;
DateTimePicker::$defaultDateTimeWithSecondsDisplayFormat = static::$defaultDateTimeWithSecondsDisplayFormat;
DateTimePicker::$defaultTimeDisplayFormat = static::$defaultTimeDisplayFormat;
DateTimePicker::$defaultTimeWithSecondsDisplayFormat = static::$defaultTimeWithSecondsDisplayFormat;
}
}
Loading

0 comments on commit 830f6a0

Please sign in to comment.