From 0fbfa4a9e047f4f5e72dde4351c55ab4aa7e7126 Mon Sep 17 00:00:00 2001 From: raza9798 Date: Thu, 22 Aug 2024 02:26:09 +0530 Subject: [PATCH] site-settings implementation on dashboard --- .../Resources/GlobalSettingsResource.php | 106 ++++++++++++++++++ .../Pages/CreateGlobalSettings.php | 12 ++ .../Pages/EditGlobalSettings.php | 19 ++++ .../Pages/ListGlobalSettings.php | 19 ++++ 4 files changed, 156 insertions(+) create mode 100644 app/Filament/Admin/Resources/GlobalSettingsResource.php create mode 100644 app/Filament/Admin/Resources/GlobalSettingsResource/Pages/CreateGlobalSettings.php create mode 100644 app/Filament/Admin/Resources/GlobalSettingsResource/Pages/EditGlobalSettings.php create mode 100644 app/Filament/Admin/Resources/GlobalSettingsResource/Pages/ListGlobalSettings.php diff --git a/app/Filament/Admin/Resources/GlobalSettingsResource.php b/app/Filament/Admin/Resources/GlobalSettingsResource.php new file mode 100644 index 0000000..4c8b04e --- /dev/null +++ b/app/Filament/Admin/Resources/GlobalSettingsResource.php @@ -0,0 +1,106 @@ +string('name')->nullable(); + // $table->string('currency')->nullable(); + // $table->string('default_language')->nullable(); + // $table->text('address')->nullable(); + // $table->string('country')->nullable(); + // $table->string('email')->nullable(); + // $table->string('phone_01')->nullable(); + // $table->string('phone_02')->nullable(); + // $table->string('phone_03')->nullable(); + // $table->string('phone_04')->nullable(); + // $table->string('facebook')->nullable(); + // $table->string('twitter')->nullable(); + // $table->string('github')->nullable(); + // $table->string('youtube')->nullable(); + // $table->decimal('sales_commission_percentage', 5, 2)->default(1.00); + // $table->decimal('lettings_commission_percentage', 5, 2)->default(8.00); + return $form + ->schema([ + TextInput::make('name')->autocapitalize('words')->required(), + TextInput::make('currency')->autocapitalize('words')->required(), + TextInput::make('default_language')->autocapitalize('words')->required(), + TextInput::make('address')->autocapitalize('words')->required(), + TextInput::make('country')->autocapitalize('words')->required(), + TextInput::make('email')->autocapitalize('words')->required(), + TextInput::make('phone_01')->autocapitalize('words')->required(), + TextInput::make('phone_02')->autocapitalize('words'), + TextInput::make('phone_03')->autocapitalize('words'), + TextInput::make('phone_04')->autocapitalize('words'), + TextInput::make('facebook')->autocapitalize('words')->required(), + TextInput::make('twitter')->autocapitalize('words')->required(), + TextInput::make('github')->autocapitalize('words')->required(), + TextInput::make('youtube')->autocapitalize('words')->required(), + TextInput::make('sales_commission_percentage')->autocapitalize('words')->required(), + TextInput::make('lettings_commission_percentage')->autocapitalize('words')->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('name'), + TextColumn::make('currency'), + TextColumn::make('default_language')->label('language'), + TextColumn::make('country'), + TextColumn::make('email'), + TextColumn::make('phone_01')->label('Phone'), + ]) + ->filters([ + // + ]) + ->actions([ + Tables\Actions\EditAction::make(), + ]) + ->bulkActions([ + Tables\Actions\BulkActionGroup::make([ + Tables\Actions\DeleteBulkAction::make(), + ]), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListGlobalSettings::route('/'), + 'create' => Pages\CreateGlobalSettings::route('/create'), + 'edit' => Pages\EditGlobalSettings::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Admin/Resources/GlobalSettingsResource/Pages/CreateGlobalSettings.php b/app/Filament/Admin/Resources/GlobalSettingsResource/Pages/CreateGlobalSettings.php new file mode 100644 index 0000000..daa67de --- /dev/null +++ b/app/Filament/Admin/Resources/GlobalSettingsResource/Pages/CreateGlobalSettings.php @@ -0,0 +1,12 @@ +