adds help texts

This commit is contained in:
2026-02-16 16:00:16 +01:00
parent 514f1cb483
commit 78c51d55b5
9 changed files with 95 additions and 46 deletions

View File

@@ -11,6 +11,7 @@
// Fixes Nova 5 incompatibility where field names are PendingTranslation objects instead of strings. // Fixes Nova 5 incompatibility where field names are PendingTranslation objects instead of strings.
final class DownloadExcel extends BaseDownloadExcel final class DownloadExcel extends BaseDownloadExcel
{ {
protected $onlyIndexFields = false;
/** /**
* @param Model|mixed $row * @param Model|mixed $row
*/ */

View File

@@ -79,32 +79,38 @@ public function fields(NovaRequest $request): array
BelongsTo::make('Session', 'session', SessionResource::class) BelongsTo::make('Session', 'session', SessionResource::class)
->sortable() ->sortable()
->filterable() ->filterable()
->rules('required'), ->readonly()
->help('The questionnaire session this answer belongs to.'),
BelongsTo::make('Question', 'question', QuestionResource::class) BelongsTo::make('Question', 'question', QuestionResource::class)
->sortable() ->sortable()
->filterable() ->filterable()
->rules('required'), ->readonly()
->help('The question that was answered.'),
Text::make('Value') Text::make('Value')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable() ->copyable()
->rules('nullable', 'max:255'), ->readonly()
->help('The selected answer: "yes", "no", or "not_applicable". Empty for open text questions.'),
Textarea::make('Text Value') Textarea::make('Text Value')
->alwaysShow() ->alwaysShow()
->rules('nullable'), ->readonly()
->help('Any written details or free text the user provided for this question.'),
DateTime::make('Created At') DateTime::make('Created At')
->exceptOnForms() ->exceptOnForms()
->sortable() ->sortable()
->filterable(), ->filterable()
->help('When this answer was first saved.'),
DateTime::make('Updated At') DateTime::make('Updated At')
->exceptOnForms() ->exceptOnForms()
->sortable() ->sortable()
->filterable(), ->filterable()
->help('When this answer was last changed.'),
]; ];
} }

View File

@@ -72,12 +72,14 @@ public function fields(NovaRequest $request): array
->sortable() ->sortable()
->filterable() ->filterable()
->copyable() ->copyable()
->help('The name of this assessment category, such as Audit, Tax, or Legal.')
->rules('required', 'max:255'), ->rules('required', 'max:255'),
Number::make('Sort Order') Number::make('Sort Order')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable() ->copyable()
->help('Controls the display order of categories. Lower numbers appear first.')
->rules('required', 'integer'), ->rules('required', 'integer'),
HasMany::make('Question Groups', 'questionGroups', QuestionGroupResource::class), HasMany::make('Question Groups', 'questionGroups', QuestionGroupResource::class),

View File

@@ -86,34 +86,40 @@ public function fields(NovaRequest $request): array
->nullable() ->nullable()
->sortable() ->sortable()
->filterable() ->filterable()
->rules('nullable'), ->rules('nullable')
->help('The user who performed this action. May be empty for system events.'),
BelongsTo::make('Session', 'session', SessionResource::class) BelongsTo::make('Session', 'session', SessionResource::class)
->nullable() ->nullable()
->sortable() ->sortable()
->filterable() ->filterable()
->rules('nullable'), ->rules('nullable')
->help('The questionnaire session related to this action, if any.'),
BelongsTo::make('Category', 'category', CategoryResource::class) BelongsTo::make('Category', 'category', CategoryResource::class)
->nullable() ->nullable()
->sortable() ->sortable()
->filterable() ->filterable()
->rules('nullable'), ->rules('nullable')
->help('The assessment category related to this action, if any.'),
Text::make('Action') Text::make('Action')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable() ->copyable()
->rules('required', 'max:255'), ->rules('required', 'max:255')
->help('What happened, e.g. "login", "session_started", "answer_saved", "screening_completed".'),
Code::make('Metadata') Code::make('Metadata')
->json() ->json()
->rules('nullable'), ->rules('nullable')
->help('Additional details about this action in a structured format.'),
DateTime::make('Created At') DateTime::make('Created At')
->exceptOnForms() ->exceptOnForms()
->sortable() ->sortable()
->filterable(), ->filterable()
->help('When this action occurred.'),
]; ];
} }

View File

@@ -73,25 +73,30 @@ public function fields(NovaRequest $request): array
BelongsTo::make('Category', 'category', CategoryResource::class) BelongsTo::make('Category', 'category', CategoryResource::class)
->sortable() ->sortable()
->filterable() ->filterable()
->rules('required'), ->rules('required')
->help('The assessment category this group of questions belongs to, such as Audit or Tax.'),
Text::make('Name') Text::make('Name')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable() ->copyable()
->rules('required', 'max:255'), ->rules('required', 'max:255')
->help('The title of this question group, shown as a section heading in the questionnaire.'),
Number::make('Sort Order') Number::make('Sort Order')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable() ->copyable()
->rules('required', 'integer'), ->rules('required', 'integer')
->help('Controls the display order within the category. Lower numbers appear first.'),
Textarea::make('Description') Textarea::make('Description')
->rules('nullable'), ->rules('nullable')
->help('An optional description shown to users at the top of this question group.'),
Textarea::make('Scoring Instructions') Textarea::make('Scoring Instructions')
->rules('nullable'), ->rules('nullable')
->help('Optional instructions shown to users explaining how this section is scored, e.g. "If you answer yes, you will score 1 point."'),
HasMany::make('Questions', 'questions', QuestionResource::class), HasMany::make('Questions', 'questions', QuestionResource::class),
]; ];

View File

@@ -87,25 +87,30 @@ public function fields(NovaRequest $request): array
BelongsTo::make('Question Group', 'questionGroup', QuestionGroupResource::class) BelongsTo::make('Question Group', 'questionGroup', QuestionGroupResource::class)
->sortable() ->sortable()
->filterable(), ->filterable()
->help('The group this question belongs to. Questions are shown together by group in the questionnaire.'),
Textarea::make('Text') Textarea::make('Text')
->rules('required') ->rules('required')
->updateRules('required'), ->updateRules('required')
->help('The full question text shown to the user in the questionnaire.'),
Boolean::make('Has Yes') Boolean::make('Has Yes')
->sortable() ->sortable()
->filterable(), ->filterable()
->help('When enabled, a "Yes" answer option is shown for this question.'),
Boolean::make('Has No') Boolean::make('Has No')
->sortable() ->sortable()
->filterable(), ->filterable()
->help('When enabled, a "No" answer option is shown for this question.'),
Boolean::make('Has NA', 'has_na') Boolean::make('Has NA', 'has_na')
->sortable() ->sortable()
->filterable(), ->filterable()
->help('When enabled, a "Not Applicable" answer option is shown for this question.'),
Select::make('Details') Select::make('Details')
->options([ ->options([
@@ -117,15 +122,18 @@ public function fields(NovaRequest $request): array
->displayUsingLabels() ->displayUsingLabels()
->nullable() ->nullable()
->sortable() ->sortable()
->filterable(), ->filterable()
->help('Controls when the user is asked for additional details. "Required" always asks, "Optional" lets the user choose, "Required on Yes/No" only asks when that answer is selected.'),
Number::make('Sort Order') Number::make('Sort Order')
->sortable() ->sortable()
->filterable(), ->filterable()
->help('Controls the display order within the question group. Lower numbers appear first.'),
Boolean::make('Is Scored') Boolean::make('Is Scored')
->sortable() ->sortable()
->filterable(), ->filterable()
->help('When enabled, this question counts toward the total score. A "Yes" answer scores 1 point.'),
HasMany::make('Answers', 'answers', AnswerResource::class), HasMany::make('Answers', 'answers', AnswerResource::class),
]; ];

View File

@@ -86,23 +86,27 @@ public function fields(NovaRequest $request): array
BelongsTo::make('User', 'user', User::class) BelongsTo::make('User', 'user', User::class)
->sortable() ->sortable()
->filterable() ->filterable()
->rules('required'), ->rules('required')
->help('The person who completed this pre-screening.'),
Number::make('Score') Number::make('Score')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable() ->copyable()
->rules('required', 'integer'), ->rules('required', 'integer')
->help('The number of "Yes" answers out of 10 pre-screening questions.'),
Boolean::make('Passed') Boolean::make('Passed')
->sortable() ->sortable()
->filterable() ->filterable()
->rules('required', 'boolean'), ->rules('required', 'boolean')
->help('Whether the user scored 5 or more points and was allowed to continue to the full questionnaire.'),
DateTime::make('Created At') DateTime::make('Created At')
->exceptOnForms() ->exceptOnForms()
->sortable() ->sortable()
->filterable(), ->filterable()
->help('When this pre-screening was started.'),
HasMany::make('Sessions', 'sessions', SessionResource::class), HasMany::make('Sessions', 'sessions', SessionResource::class),
]; ];

View File

@@ -87,18 +87,21 @@ public function fields(NovaRequest $request): array
BelongsTo::make('User', 'user', User::class) BelongsTo::make('User', 'user', User::class)
->sortable() ->sortable()
->filterable() ->filterable()
->rules('required'), ->rules('required')
->help('The person who started this questionnaire session.'),
BelongsTo::make('Category', 'category', CategoryResource::class) BelongsTo::make('Category', 'category', CategoryResource::class)
->sortable() ->sortable()
->filterable() ->filterable()
->rules('required'), ->rules('required')
->help('The assessment category for this session, such as Audit or Tax.'),
BelongsTo::make('Screening', 'screening', ScreeningResource::class) BelongsTo::make('Screening', 'screening', ScreeningResource::class)
->nullable() ->nullable()
->sortable() ->sortable()
->filterable() ->filterable()
->rules('nullable'), ->rules('nullable')
->help('The pre-screening that was completed before starting this session.'),
Select::make('Status') Select::make('Status')
->options([ ->options([
@@ -108,13 +111,15 @@ public function fields(NovaRequest $request): array
]) ])
->displayUsingLabels() ->displayUsingLabels()
->sortable() ->sortable()
->filterable(), ->filterable()
->help('The current state of this session. "In Progress" means the user has not yet submitted, "Completed" means submitted, "Abandoned" means the user left without finishing.'),
Number::make('Score') Number::make('Score')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable() ->copyable()
->rules('nullable', 'integer'), ->rules('nullable', 'integer')
->help('The total score from all scored questions. Only "Yes" answers count as points.'),
Select::make('Result') Select::make('Result')
->options([ ->options([
@@ -124,15 +129,18 @@ public function fields(NovaRequest $request): array
]) ])
->displayUsingLabels() ->displayUsingLabels()
->sortable() ->sortable()
->filterable(), ->filterable()
->help('The final outcome based on the score. "Go" (10+ points) means pursue the opportunity, "Consult Leadership" (5-9 points) means seek advice, "No Go" (1-4 points) means do not pursue.'),
Textarea::make('Additional Comments') Textarea::make('Additional Comments')
->rules('nullable'), ->rules('nullable')
->help('Any extra notes the user added at the end of the questionnaire.'),
DateTime::make('Completed At') DateTime::make('Completed At')
->sortable() ->sortable()
->filterable() ->filterable()
->rules('nullable'), ->rules('nullable')
->help('The date and time when the user submitted this session.'),
HasMany::make('Answers', 'answers', AnswerResource::class), HasMany::make('Answers', 'answers', AnswerResource::class),

View File

@@ -51,44 +51,53 @@ public function fields(NovaRequest $request): array
BelongsTo::make('Role', 'role', RoleResource::class) BelongsTo::make('Role', 'role', RoleResource::class)
->sortable() ->sortable()
->filterable(), ->filterable()
->help('The user\'s role, which controls what they can access in the admin panel.'),
Text::make('Name') Text::make('Name')
->sortable() ->sortable()
->rules('required', 'max:255'), ->rules('required', 'max:255')
->help('The user\'s full name, imported from Azure AD when they first log in.'),
Text::make('Email') Text::make('Email')
->sortable() ->sortable()
->rules('required', 'email', 'max:254') ->rules('required', 'email', 'max:254')
->creationRules('unique:users,email') ->creationRules('unique:users,email')
->updateRules('unique:users,email,{{resourceId}}'), ->updateRules('unique:users,email,{{resourceId}}')
->help('The user\'s email address, used to identify them when logging in via Azure AD.'),
Text::make('Azure ID', 'azure_id') Text::make('Azure ID', 'azure_id')
->onlyOnDetail() ->onlyOnDetail()
->copyable(), ->copyable()
->help('A unique identifier from Azure AD. Set automatically when the user logs in.'),
Text::make('Photo', 'photo') Text::make('Photo', 'photo')
->onlyOnDetail() ->onlyOnDetail()
->copyable(), ->copyable()
->help('A link to the user\'s profile photo from Azure AD.'),
Text::make('Job Title', 'job_title') Text::make('Job Title', 'job_title')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable(), ->copyable()
->help('The user\'s job title, imported from Azure AD.'),
Text::make('Department') Text::make('Department')
->sortable() ->sortable()
->filterable() ->filterable()
->copyable(), ->copyable()
->help('The department the user belongs to, imported from Azure AD.'),
Text::make('Phone') Text::make('Phone')
->sortable() ->sortable()
->copyable(), ->copyable()
->help('The user\'s phone number, imported from Azure AD.'),
Password::make('Password') Password::make('Password')
->onlyOnForms() ->onlyOnForms()
->creationRules($this->passwordRules()) ->creationRules($this->passwordRules())
->updateRules($this->optionalPasswordRules()), ->updateRules($this->optionalPasswordRules())
->help('Only needed for admin panel access. Regular users log in via Azure AD and do not need a password.'),
]; ];
} }