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

[ADVAPP-274]: Introduce configuration for tracking service quality in service management #481

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ public function up(): void
{
Schema::create('service_request_types', function (Blueprint $table) {
$table->uuid('id')->primary();

$table->string('name');
$table->boolean('has_enabled_feedback_collection')->default(false);
$table->boolean('has_enabled_csat')->default(false);
$table->boolean('has_enabled_nps')->default(false);

$table->timestamps();
$table->softDeletes();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@

namespace AdvisingApp\ServiceManagement\Filament\Resources\ServiceRequestTypeResource\Pages;

use Filament\Forms\Get;
use Filament\Forms\Form;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\CreateRecord;
use AdvisingApp\ServiceManagement\Filament\Resources\ServiceRequestTypeResource;
Expand All @@ -49,10 +53,26 @@ public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->label('Name')
->required()
->string(),
Section::make()
->columns()
->schema([
TextInput::make('name')
->label('Name')
->required()
->string(),
Group::make()
->schema([
Toggle::make('has_enabled_feedback_collection')
->label('Enable feedback collection')
->live(),
Toggle::make('has_enabled_csat')
->label('CSAT')
->visible(fn (Get $get) => $get('has_enabled_feedback_collection')),
Toggle::make('has_enabled_nps')
->label('NPS')
->visible(fn (Get $get) => $get('has_enabled_feedback_collection')),
]),
]),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@

namespace AdvisingApp\ServiceManagement\Filament\Resources\ServiceRequestTypeResource\Pages;

use Filament\Forms\Get;
use Filament\Forms\Form;
use Filament\Actions\DeleteAction;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\EditRecord;
use AdvisingApp\ServiceManagement\Filament\Resources\ServiceRequestTypeResource;
Expand All @@ -50,10 +54,26 @@ public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->label('Name')
->required()
->string(),
Section::make()
->columns()
->schema([
TextInput::make('name')
->label('Name')
->required()
->string(),
Group::make()
->schema([
Toggle::make('has_enabled_feedback_collection')
->label('Enable feedback collection')
->live(),
Toggle::make('has_enabled_csat')
->label('CSAT')
->visible(fn (Get $get) => $get('has_enabled_feedback_collection')),
Toggle::make('has_enabled_nps')
->label('NPS')
->visible(fn (Get $get) => $get('has_enabled_feedback_collection')),
]),
]),
]);
}

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

use Filament\Actions\EditAction;
use Filament\Infolists\Infolist;
use Filament\Infolists\Components\Group;
use Filament\Resources\Pages\ViewRecord;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
Expand All @@ -54,6 +55,7 @@ public function infolist(Infolist $infolist): Infolist
return $infolist
->schema([
Section::make()
->columns()
->schema([
TextEntry::make('name')
->label('Name'),
Expand All @@ -62,8 +64,25 @@ public function infolist(Infolist $infolist): Infolist
->hidden(fn (ServiceRequestType $record) => ! $record->form)
->url(fn (ServiceRequestType $record) => $record->form ? ServiceRequestFormResource::getUrl('edit', ['record' => $record?->form]) : null)
->color('primary'),
])
->columns(),
Group::make()
->schema([
TextEntry::make('has_enabled_feedback_collection')
->hiddenLabel()
->state('Feedback collection')
->badge()
->color(fn (ServiceRequestType $record) => $record->has_enabled_feedback_collection ? 'success' : 'gray'),
TextEntry::make('has_enabled_csat')
->hiddenLabel()
->state('CSAT')
->badge()
->color(fn (ServiceRequestType $record) => $record->has_enabled_csat ? 'success' : 'gray'),
TextEntry::make('has_enabled_nps')
->hiddenLabel()
->state('NPS')
->badge()
->color(fn (ServiceRequestType $record) => $record->has_enabled_nps ? 'success' : 'gray'),
]),
]),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ class ServiceRequestType extends BaseModel implements Auditable

protected $fillable = [
'name',
'has_enabled_feedback_collection',
'has_enabled_csat',
'has_enabled_nps',
];

protected $casts = [
'has_enabled_feedback_collection' => 'boolean',
'has_enabled_csat' => 'boolean',
'has_enabled_nps' => 'boolean',
];

public function serviceRequests(): HasManyThrough
Expand Down