diff --git a/config/filament-user-consent.php b/config/filament-user-consent.php index cd344e3..438a0cc 100644 --- a/config/filament-user-consent.php +++ b/config/filament-user-consent.php @@ -1,24 +1,18 @@ [ - App\Models\Admin::class, - App\Models\Practitioner::class, - App\Models\EndUser::class, + App\Models\User::class, ], 'auth-guards' => 'web', 'options' => [ - 'App\Models\Admin' => 'Admin', - 'App\Models\Practitioner' => 'Practitioner', - 'App\Models\EndUser' => 'EndUser', + App\Models\User::class => 'User', ], 'notify' => ['mail'], @@ -28,13 +22,25 @@ ], 'navigation' => [ - 'sort' => 50, - 'group' => 'Content', + 'consent_options' => [ + 'sort' => 50, + 'label' => 'Consent Options', + 'icon' => 'heroicon-o-check-badge', + 'group' => 'Content', + 'cluster' => false, + ], + 'consent_responses' => [ + 'sort' => 60, + 'label' => 'Consent Responses', + 'icon' => 'heroicon-o-user-circle', + 'group' => 'Content', + 'cluster' => false, + ], ], 'listeners' => [ //Event triggered after a consent updated - ConsentUpdated::class => [ + ConsentUpdated::class => [ // Default listeners for this event // You may want to update mailchump if consent withdrawn for marketing ], @@ -45,32 +51,32 @@ ], //send user an email with a copy of the consent after saving. - 'notify' => ['mail'], + 'notify' => ['mail'], 'email-template' => 'vendor.user-consent.layouts.email', //The mailable class to use for sending consent notification - 'mailable' => \Visualbuilder\FilamentUserConsent\Mail\ConsentsUpdatedMail::class, + 'mailable' => \Visualbuilder\FilamentUserConsent\Mail\ConsentsUpdatedMail::class, 'components' => [ 'placeholder' => 'Placeholder', - 'likert' => 'Likert Slider', - 'text' => 'Free Text Input', - 'email' => 'Email Input', - 'number' => 'Number Input', - 'textarea' => 'Text area', - 'select' => 'Select dropdown', - 'radio' => 'Radio options', - 'check' => 'Checkbox', - 'date' => 'Date Picker', - 'datetime' => 'Date & Time Picker', + 'likert' => 'Likert Slider', + 'text' => 'Free Text Input', + 'email' => 'Email Input', + 'number' => 'Number Input', + 'textarea' => 'Text area', + 'select' => 'Select dropdown', + 'radio' => 'Radio options', + 'check' => 'Checkbox', + 'date' => 'Date Picker', + 'datetime' => 'Date & Time Picker', ], 'autofill_columns' => [ - 'salutation' => 'Title', - 'full_name' => 'Full Name', - 'email' => 'Email address', - 'mobile' => 'Mobile number', + 'salutation' => 'Title', + 'full_name' => 'Full Name', + 'email' => 'Email address', + 'mobile' => 'Mobile number', 'phone_number' => 'Phone number', 'full_address' => "Full address" ] diff --git a/src/Resources/ConsentOptionResource.php b/src/Resources/ConsentOptionResource.php index 7adf829..637df10 100644 --- a/src/Resources/ConsentOptionResource.php +++ b/src/Resources/ConsentOptionResource.php @@ -27,16 +27,31 @@ class ConsentOptionResource extends Resource { protected static ?string $model = ConsentOption::class; - protected static ?string $navigationIcon = 'heroicon-o-clipboard'; + protected static ?string $navigationIcon = 'heroicon-o-check-badge'; + + public static function getNavigationLabel(): string + { + return config('filament-user-consent.navigation.consent_options.label'); + } + + public static function getNavigationIcon(): ?string + { + return config('filament-user-consent.navigation.consent_options.icon'); + } public static function getNavigationGroup(): ?string { - return config('filament-user-consent.navigation.group'); + return config('filament-user-consent.navigation.consent_options.group'); } public static function getNavigationSort(): ?int { - return config('filament-user-consent.navigation.sort'); + return config('filament-user-consent.navigation.consent_options.sort'); + } + + public static function getCluster(): ?string + { + return config('filament-user-consent.navigation.consent_options.cluster'); } public static function form(Form $form): Form @@ -95,10 +110,10 @@ public static function form(Form $form): Form ->label('Contract text') ->required() ->columnSpanFull(), - + ])->columns(3), Section::make('Additional Info')->schema([ - + Repeater::make('fields')->label('') ->schema([ Forms\Components\TextInput::make('name') @@ -170,7 +185,7 @@ public static function table(Table $table): Table ]) ->defaultSort('created_at', 'desc') ->actions([ - + ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([]), diff --git a/src/Resources/ConsentOptionResponseResource.php b/src/Resources/ConsentOptionResponseResource.php index f32dd18..c59bf7d 100644 --- a/src/Resources/ConsentOptionResponseResource.php +++ b/src/Resources/ConsentOptionResponseResource.php @@ -21,26 +21,38 @@ class ConsentOptionResponseResource extends Resource { protected static ?string $model = ConsentOptionUser::class; - protected static ?string $navigationIcon = 'heroicon-o-clipboard'; - public static ?string $label = 'Consent Response'; + public static function getNavigationLabel(): string + { + return config('filament-user-consent.navigation.consent_responses.label'); + } + + public static function getNavigationIcon(): ?string + { + return config('filament-user-consent.navigation.consent_responses.icon'); + } public static function getNavigationGroup(): ?string { - return config('filament-user-consent.navigation.group'); + return config('filament-user-consent.navigation.consent_responses.group'); } public static function getNavigationSort(): ?int { - return config('filament-user-consent.navigation.sort'); + return config('filament-user-consent.navigation.consent_responses.sort'); + } + + public static function getCluster(): ?string + { + return config('filament-user-consent.navigation.consent_responses.cluster'); } public static function form(Form $form): Form { return $form ->schema([ - + ]); } @@ -66,7 +78,7 @@ public static function table(Table $table): Table Tables\Columns\TextColumn::make('created_at') ->label('Accepted at') ->sortable(), - + ]) ->filters([ Tables\Filters\SelectFilter::make('consent_option_id') @@ -110,7 +122,7 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('response'), TextEntry::make('additional_info') ->visible(fn (Model $model) => $model->additional_info), - ])->columns(3) + ])->columns(3) ]) ]), ]);