diff --git a/.claude/settings.local.json b/.claude/settings.local.json index e47f842..26b3f37 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -27,7 +27,8 @@ "mcp__playwright__browser_navigate_back", "mcp__playwright__browser_run_code", "mcp__playwright__browser_wait_for", - "WebFetch(domain:www.bakertilly.nl)" + "WebFetch(domain:www.bakertilly.nl)", + "mcp__playwright__browser_type" ] } } diff --git a/app/Http/Controllers/Auth/SocialiteController.php b/app/Http/Controllers/Auth/SocialiteController.php index e79ee9f..6cce353 100644 --- a/app/Http/Controllers/Auth/SocialiteController.php +++ b/app/Http/Controllers/Auth/SocialiteController.php @@ -6,8 +6,10 @@ use App\Http\Controllers\Controller; use App\Models\User; +use App\Services\ActivityLogger; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use Laravel\Socialite\Facades\Socialite; final class SocialiteController extends Controller @@ -37,6 +39,8 @@ public function callback(): RedirectResponse auth()->login($user); + ActivityLogger::log('login', $user->id, metadata: ['email' => $user->email, 'firm_name' => Arr::get($azureUser, 'companyName')]); + return redirect('/'); } @@ -45,6 +49,8 @@ public function callback(): RedirectResponse */ public function logout(Request $request): RedirectResponse { + ActivityLogger::log('logout', auth()->id()); + auth()->logout(); $request->session()->invalidate(); diff --git a/app/Http/Controllers/ScreeningController.php b/app/Http/Controllers/ScreeningController.php index 7a8b9b4..deaa9da 100644 --- a/app/Http/Controllers/ScreeningController.php +++ b/app/Http/Controllers/ScreeningController.php @@ -7,8 +7,10 @@ use App\Http\Requests\Screening\UpdateScreeningRequest; use App\Models\Category; use App\Models\Screening; +use App\Services\ActivityLogger; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use Inertia\Inertia; use Inertia\Response; @@ -23,6 +25,8 @@ public function store(Request $request): RedirectResponse 'user_id' => auth()->id(), ]); + ActivityLogger::log('screening_started', auth()->id()); + return redirect()->route('screening.show', $screening); } @@ -44,8 +48,10 @@ public function update(UpdateScreeningRequest $request, Screening $screening): R { $validated = $request->validated(); - $this->saveAnswers($screening, $validated['answers']); - $this->calculateAndUpdateScore($screening, $validated['answers']); + $this->saveAnswers($screening, Arr::get($validated, 'answers')); + $this->calculateAndUpdateScore($screening, Arr::get($validated, 'answers')); + + ActivityLogger::log('screening_completed', auth()->id(), metadata: ['score' => $screening->score, 'passed' => $screening->passed]); return redirect()->route('screening.result', $screening); } diff --git a/app/Http/Controllers/SessionController.php b/app/Http/Controllers/SessionController.php index 319a761..9251c4f 100644 --- a/app/Http/Controllers/SessionController.php +++ b/app/Http/Controllers/SessionController.php @@ -6,9 +6,11 @@ use App\Http\Requests\Session\UpdateSessionRequest; use App\Models\Session; +use App\Services\ActivityLogger; use App\Services\ScoringService; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Illuminate\Support\Arr; use Inertia\Inertia; use Inertia\Response; @@ -26,6 +28,8 @@ public function store(Request $request): RedirectResponse 'status' => 'in_progress', ]); + ActivityLogger::log('session_started', auth()->id(), sessionId: $session->id, categoryId: (int) $request->input('category_id'), metadata: ['category_id' => $request->input('category_id')]); + return redirect()->route('sessions.show', $session); } @@ -42,6 +46,8 @@ public function show(Session $session): Response ->orderBy('sort_order') ->get(); + ActivityLogger::log('step_viewed', auth()->id(), sessionId: $session->id, categoryId: $session->category_id, metadata: ['question_group_id' => $questionGroups->first()?->id]); + $answers = $session->answers()->get()->keyBy('question_id'); $scoringService = new ScoringService; @@ -62,16 +68,16 @@ public function update(UpdateSessionRequest $request, Session $session): Redirec { $validated = $request->validated(); - if (isset($validated['basic_info'])) { - $session->update(['basic_info' => $validated['basic_info']]); + if (Arr::has($validated, 'basic_info')) { + $session->update(['basic_info' => Arr::get($validated, 'basic_info')]); } - if (isset($validated['answers'])) { - $this->saveAnswers($session, $validated['answers']); + if (Arr::has($validated, 'answers')) { + $this->saveAnswers($session, Arr::get($validated, 'answers')); } - if (isset($validated['additional_comments'])) { - $session->update(['additional_comments' => $validated['additional_comments']]); + if (Arr::has($validated, 'additional_comments')) { + $session->update(['additional_comments' => Arr::get($validated, 'additional_comments')]); } if ($request->boolean('complete')) { @@ -90,10 +96,15 @@ private function saveAnswers(Session $session, array $answers): void $session->answers()->updateOrCreate( ['question_id' => (int) $questionId], [ - 'value' => $answer['value'] ?? null, - 'text_value' => $answer['text_value'] ?? null, + 'value' => Arr::get($answer, 'value'), + 'text_value' => Arr::get($answer, 'text_value'), ] ); + + ActivityLogger::log('answer_saved', auth()->id(), sessionId: $session->id, categoryId: $session->category_id, metadata: [ + 'question_id' => (int) $questionId, + 'value' => Arr::get($answer, 'value'), + ]); } } @@ -113,6 +124,8 @@ private function completeSession(Session $session): RedirectResponse 'completed_at' => now(), ]); + ActivityLogger::log('session_completed', auth()->id(), sessionId: $session->id, categoryId: $session->category_id, metadata: ['category_id' => $session->category_id, 'score' => $score, 'result' => $result]); + return redirect()->route('sessions.result', $session); } diff --git a/app/Nova/AnswerResource.php b/app/Nova/AnswerResource.php new file mode 100644 index 0000000..6358067 --- /dev/null +++ b/app/Nova/AnswerResource.php @@ -0,0 +1,127 @@ + + */ + public static string $model = \App\Models\Answer::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * + * @var string + */ + public static $title = 'id'; + + /** + * The columns that should be searched. + * + * @var array + */ + public static $search = ['id', 'value']; + + /** + * Indicates if the resource should be displayed in the sidebar. + * + * @var bool + */ + public static $displayInNavigation = false; + + /** + * Get the fields displayed by the resource. + * + * @return array + */ + public function fields(NovaRequest $request): array + { + return [ + ID::make()->sortable(), + + BelongsTo::make('Session', 'session', SessionResource::class) + ->sortable() + ->filterable() + ->rules('required'), + + BelongsTo::make('Question', 'question', QuestionResource::class) + ->sortable() + ->filterable() + ->rules('required'), + + Text::make('Value') + ->sortable() + ->filterable() + ->copyable() + ->rules('nullable', 'max:255'), + + Textarea::make('Text Value') + ->rules('nullable'), + + DateTime::make('Created At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + DateTime::make('Updated At') + ->exceptOnForms() + ->sortable() + ->filterable(), + ]; + } + + /** + * Get the cards available for the request. + * + * @return array + */ + public function cards(NovaRequest $request): array + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @return array + */ + public function filters(NovaRequest $request): array + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @return array + */ + public function lenses(NovaRequest $request): array + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @return array + */ + public function actions(NovaRequest $request): array + { + return [ + new DownloadExcel, + ]; + } +} diff --git a/app/Nova/CategoryResource.php b/app/Nova/CategoryResource.php new file mode 100644 index 0000000..f0733fc --- /dev/null +++ b/app/Nova/CategoryResource.php @@ -0,0 +1,124 @@ + + */ + public static string $model = \App\Models\Category::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * + * @var string + */ + public static $title = 'name'; + + /** + * The columns that should be searched. + * + * @var array + */ + public static $search = ['id', 'name']; + + /** + * Indicates if the resource should be displayed in the sidebar. + * + * @var bool + */ + public static $displayInNavigation = false; + + /** + * Get the fields displayed by the resource. + * + * @return array + */ + public function fields(NovaRequest $request): array + { + return [ + ID::make()->sortable(), + + Text::make('Name') + ->sortable() + ->filterable() + ->copyable() + ->rules('required', 'max:255'), + + Number::make('Sort Order') + ->sortable() + ->filterable() + ->copyable() + ->rules('required', 'integer'), + + DateTime::make('Created At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + DateTime::make('Updated At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + HasMany::make('Question Groups', 'questionGroups', QuestionGroupResource::class), + + HasMany::make('Sessions', 'sessions', SessionResource::class), + ]; + } + + /** + * Get the cards available for the request. + * + * @return array + */ + public function cards(NovaRequest $request): array + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @return array + */ + public function filters(NovaRequest $request): array + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @return array + */ + public function lenses(NovaRequest $request): array + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @return array + */ + public function actions(NovaRequest $request): array + { + return [ + new DownloadExcel, + ]; + } +} diff --git a/app/Nova/LogResource.php b/app/Nova/LogResource.php new file mode 100644 index 0000000..69954c3 --- /dev/null +++ b/app/Nova/LogResource.php @@ -0,0 +1,138 @@ + + */ + public static string $model = \App\Models\Log::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * + * @var string + */ + public static $title = 'action'; + + /** + * The columns that should be searched. + * + * @var array + */ + public static $search = ['id', 'action']; + + /** + * Indicates if the resource should be displayed in the sidebar. + * + * @var bool + */ + public static $displayInNavigation = true; + + /** + * The group associated with the resource. + * + * @var string + */ + public static $group = 'Analytics'; + + /** + * Get the fields displayed by the resource. + * + * @return array + */ + public function fields(NovaRequest $request): array + { + return [ + ID::make()->sortable(), + + BelongsTo::make('User', 'user', User::class) + ->nullable() + ->sortable() + ->filterable() + ->rules('nullable'), + + BelongsTo::make('Session', 'session', SessionResource::class) + ->nullable() + ->sortable() + ->filterable() + ->rules('nullable'), + + BelongsTo::make('Category', 'category', CategoryResource::class) + ->nullable() + ->sortable() + ->filterable() + ->rules('nullable'), + + Text::make('Action') + ->sortable() + ->filterable() + ->copyable() + ->rules('required', 'max:255'), + + Code::make('Metadata') + ->json() + ->rules('nullable'), + + DateTime::make('Created At') + ->exceptOnForms() + ->sortable() + ->filterable(), + ]; + } + + /** + * Get the cards available for the request. + * + * @return array + */ + public function cards(NovaRequest $request): array + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @return array + */ + public function filters(NovaRequest $request): array + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @return array + */ + public function lenses(NovaRequest $request): array + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @return array + */ + public function actions(NovaRequest $request): array + { + return [ + new DownloadExcel, + ]; + } +} diff --git a/app/Nova/QuestionGroupResource.php b/app/Nova/QuestionGroupResource.php new file mode 100644 index 0000000..895c115 --- /dev/null +++ b/app/Nova/QuestionGroupResource.php @@ -0,0 +1,135 @@ + + */ + public static string $model = \App\Models\QuestionGroup::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * + * @var string + */ + public static $title = 'name'; + + /** + * The columns that should be searched. + * + * @var array + */ + public static $search = ['id', 'name']; + + /** + * Indicates if the resource should be displayed in the sidebar. + * + * @var bool + */ + public static $displayInNavigation = false; + + /** + * Get the fields displayed by the resource. + * + * @return array + */ + public function fields(NovaRequest $request): array + { + return [ + ID::make()->sortable(), + + BelongsTo::make('Category', 'category', CategoryResource::class) + ->sortable() + ->filterable() + ->rules('required'), + + Text::make('Name') + ->sortable() + ->filterable() + ->copyable() + ->rules('required', 'max:255'), + + Number::make('Sort Order') + ->sortable() + ->filterable() + ->copyable() + ->rules('required', 'integer'), + + Textarea::make('Description') + ->rules('nullable'), + + Textarea::make('Scoring Instructions') + ->rules('nullable'), + + DateTime::make('Created At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + DateTime::make('Updated At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + HasMany::make('Questions', 'questions', QuestionResource::class), + ]; + } + + /** + * Get the cards available for the request. + * + * @return array + */ + public function cards(NovaRequest $request): array + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @return array + */ + public function filters(NovaRequest $request): array + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @return array + */ + public function lenses(NovaRequest $request): array + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @return array + */ + public function actions(NovaRequest $request): array + { + return [ + new DownloadExcel, + ]; + } +} diff --git a/app/Nova/QuestionResource.php b/app/Nova/QuestionResource.php new file mode 100644 index 0000000..6780167 --- /dev/null +++ b/app/Nova/QuestionResource.php @@ -0,0 +1,158 @@ + + */ + public static string $model = \App\Models\Question::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * + * @var string + */ + public static $title = 'text'; + + /** + * The columns that should be searched. + * + * @var array + */ + public static $search = ['id', 'text']; + + /** + * Indicates if the resource should be displayed in the sidebar. + * + * @var bool + */ + public static $displayInNavigation = true; + + /** + * The group associated with the resource. + * + * @var string + */ + public static $group = 'Questionnaire'; + + /** + * Get the fields displayed by the resource. + * + * @return array + */ + public function fields(NovaRequest $request): array + { + return [ + ID::make()->sortable(), + + BelongsTo::make('Question Group', 'questionGroup', QuestionGroupResource::class) + ->sortable() + ->filterable() + ->readonly(), + + Textarea::make('Text') + ->rules('required') + ->updateRules('required'), + + Boolean::make('Has Yes') + ->sortable() + ->filterable() + ->readonly(), + + Boolean::make('Has No') + ->sortable() + ->filterable() + ->readonly(), + + Boolean::make('Has NA', 'has_na') + ->sortable() + ->filterable() + ->readonly(), + + Text::make('Details') + ->sortable() + ->filterable() + ->copyable() + ->readonly(), + + Number::make('Sort Order') + ->sortable() + ->filterable() + ->copyable() + ->readonly(), + + Boolean::make('Is Scored') + ->sortable() + ->filterable() + ->readonly(), + + DateTime::make('Created At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + DateTime::make('Updated At') + ->exceptOnForms() + ->sortable() + ->filterable(), + ]; + } + + /** + * Get the cards available for the request. + * + * @return array + */ + public function cards(NovaRequest $request): array + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @return array + */ + public function filters(NovaRequest $request): array + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @return array + */ + public function lenses(NovaRequest $request): array + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @return array + */ + public function actions(NovaRequest $request): array + { + return [ + new DownloadExcel, + ]; + } +} diff --git a/app/Nova/ScreeningResource.php b/app/Nova/ScreeningResource.php new file mode 100644 index 0000000..aea1584 --- /dev/null +++ b/app/Nova/ScreeningResource.php @@ -0,0 +1,134 @@ + + */ + public static string $model = \App\Models\Screening::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * + * @var string + */ + public static $title = 'id'; + + /** + * The columns that should be searched. + * + * @var array + */ + public static $search = ['id']; + + /** + * Indicates if the resource should be displayed in the sidebar. + * + * @var bool + */ + public static $displayInNavigation = true; + + /** + * The group associated with the resource. + * + * @var string + */ + public static $group = 'Questionnaire'; + + /** + * Get the fields displayed by the resource. + * + * @return array + */ + public function fields(NovaRequest $request): array + { + return [ + ID::make()->sortable(), + + BelongsTo::make('User', 'user', User::class) + ->sortable() + ->filterable() + ->rules('required'), + + Number::make('Score') + ->sortable() + ->filterable() + ->copyable() + ->rules('required', 'integer'), + + Boolean::make('Passed') + ->sortable() + ->filterable() + ->rules('required', 'boolean'), + + DateTime::make('Created At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + DateTime::make('Updated At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + HasMany::make('Sessions', 'sessions', SessionResource::class), + ]; + } + + /** + * Get the cards available for the request. + * + * @return array + */ + public function cards(NovaRequest $request): array + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @return array + */ + public function filters(NovaRequest $request): array + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @return array + */ + public function lenses(NovaRequest $request): array + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @return array + */ + public function actions(NovaRequest $request): array + { + return [ + new DownloadExcel, + ]; + } +} diff --git a/app/Nova/SessionResource.php b/app/Nova/SessionResource.php new file mode 100644 index 0000000..633545e --- /dev/null +++ b/app/Nova/SessionResource.php @@ -0,0 +1,168 @@ + + */ + public static string $model = \App\Models\Session::class; + + /** + * The single value that should be used to represent the resource when being displayed. + * + * @var string + */ + public static $title = 'id'; + + /** + * The columns that should be searched. + * + * @var array + */ + public static $search = ['id', 'status', 'result']; + + /** + * Indicates if the resource should be displayed in the sidebar. + * + * @var bool + */ + public static $displayInNavigation = true; + + /** + * The group associated with the resource. + * + * @var string + */ + public static $group = 'Questionnaire'; + + /** + * Get the fields displayed by the resource. + * + * @return array + */ + public function fields(NovaRequest $request): array + { + return [ + ID::make()->sortable(), + + BelongsTo::make('User', 'user', User::class) + ->sortable() + ->filterable() + ->rules('required'), + + BelongsTo::make('Category', 'category', CategoryResource::class) + ->sortable() + ->filterable() + ->rules('required'), + + BelongsTo::make('Screening', 'screening', ScreeningResource::class) + ->nullable() + ->sortable() + ->filterable() + ->rules('nullable'), + + Text::make('Status') + ->sortable() + ->filterable() + ->copyable() + ->rules('required', 'max:255'), + + Number::make('Score') + ->sortable() + ->filterable() + ->copyable() + ->rules('nullable', 'integer'), + + Text::make('Result') + ->sortable() + ->filterable() + ->copyable() + ->rules('nullable', 'max:255'), + + Code::make('Basic Info', 'basic_info') + ->json() + ->rules('nullable'), + + Textarea::make('Additional Comments') + ->rules('nullable'), + + DateTime::make('Completed At') + ->sortable() + ->filterable() + ->rules('nullable'), + + DateTime::make('Created At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + DateTime::make('Updated At') + ->exceptOnForms() + ->sortable() + ->filterable(), + + HasMany::make('Answers', 'answers', AnswerResource::class), + + HasMany::make('Logs', 'logs', LogResource::class), + ]; + } + + /** + * Get the cards available for the request. + * + * @return array + */ + public function cards(NovaRequest $request): array + { + return []; + } + + /** + * Get the filters available for the resource. + * + * @return array + */ + public function filters(NovaRequest $request): array + { + return []; + } + + /** + * Get the lenses available for the resource. + * + * @return array + */ + public function lenses(NovaRequest $request): array + { + return []; + } + + /** + * Get the actions available for the resource. + * + * @return array + */ + public function actions(NovaRequest $request): array + { + return [ + new DownloadExcel, + ]; + } +} diff --git a/app/Nova/User.php b/app/Nova/User.php index f52f8bd..aa0d224 100644 --- a/app/Nova/User.php +++ b/app/Nova/User.php @@ -1,5 +1,7 @@ $userId, + 'session_id' => $sessionId, + 'category_id' => $categoryId, + 'action' => $action, + 'metadata' => $metadata, + ]); + } +} diff --git a/composer.json b/composer.json index 677efef..ac05227 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "laravel/framework": "^12.0", "laravel/nova": "^5.0", "laravel/socialite": "^5.24", - "laravel/tinker": "^2.10.1" + "laravel/tinker": "^2.10.1", + "maatwebsite/laravel-nova-excel": "^1.3" }, "require-dev": { "fakerphp/faker": "^1.23", diff --git a/composer.lock b/composer.lock index 8235452..db6b2ad 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "846969b15fec689e62554bd1be9c57a8", + "content-hash": "c5908b1cf6b95103d6009afd8de09581", "packages": [ { "name": "bacon/bacon-qr-code", @@ -247,6 +247,85 @@ ], "time": "2024-02-09T16:56:22+00:00" }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, { "name": "composer/semver", "version": "3.4.4", @@ -747,6 +826,67 @@ ], "time": "2025-03-06T22:45:56+00:00" }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.19.0", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "b287d2a16aceffbf6e0295559b39662612b77fcf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/b287d2a16aceffbf6e0295559b39662612b77fcf", + "reference": "b287d2a16aceffbf6e0295559b39662612b77fcf", + "shasum": "" + }, + "require": { + "php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" + }, + "require-dev": { + "cerdic/css-tidy": "^1.7 || ^2.0", + "simpletest/simpletest": "dev-master" + }, + "suggest": { + "cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.", + "ext-bcmath": "Used for unit conversion and imagecrash protection", + "ext-iconv": "Converts text to and from non-UTF-8 encodings", + "ext-tidy": "Used for pretty-printing HTML" + }, + "type": "library", + "autoload": { + "files": [ + "library/HTMLPurifier.composer.php" + ], + "psr-0": { + "HTMLPurifier": "library/" + }, + "exclude-from-classmap": [ + "/library/HTMLPurifier/Language/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-or-later" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "support": { + "issues": "https://github.com/ezyang/htmlpurifier/issues", + "source": "https://github.com/ezyang/htmlpurifier/tree/v4.19.0" + }, + "time": "2025-10-17T16:34:55+00:00" + }, { "name": "firebase/php-jwt", "version": "v7.0.2", @@ -2149,6 +2289,58 @@ }, "time": "2025-12-19T19:16:45+00:00" }, + { + "name": "laravie/serialize-queries", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/laravie/serialize-queries.git", + "reference": "46b3cf05d09d1c7e35648181d2f5eadf5fe9967c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravie/serialize-queries/zipball/46b3cf05d09d1c7e35648181d2f5eadf5fe9967c", + "reference": "46b3cf05d09d1c7e35648181d2f5eadf5fe9967c", + "shasum": "" + }, + "require": { + "illuminate/database": "^10.48.23 || ^11.31 || ^12.0", + "illuminate/queue": "^10.48.23 || ^11.31 || ^12.0", + "laravel/serializable-closure": "^1.3 || ^2.0", + "php": "^8.1" + }, + "require-dev": { + "laravel/pint": "^1.20", + "orchestra/testbench": "^8.28 || ^9.6 || ^10.0", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.1 || ^11.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Laravie\\SerializesQuery\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com" + } + ], + "description": "Serializable Laravel Query Builder", + "support": { + "issues": "https://github.com/laravie/serialize-queries/issues", + "source": "https://github.com/laravie/serialize-queries/tree/v3.2.0" + }, + "time": "2025-02-17T04:39:20+00:00" + }, { "name": "league/commonmark", "version": "2.8.0", @@ -2784,6 +2976,330 @@ ], "time": "2026-01-15T06:54:53+00:00" }, + { + "name": "maatwebsite/excel", + "version": "3.1.67", + "source": { + "type": "git", + "url": "https://github.com/SpartnerNL/Laravel-Excel.git", + "reference": "e508e34a502a3acc3329b464dad257378a7edb4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/e508e34a502a3acc3329b464dad257378a7edb4d", + "reference": "e508e34a502a3acc3329b464dad257378a7edb4d", + "shasum": "" + }, + "require": { + "composer/semver": "^3.3", + "ext-json": "*", + "illuminate/support": "5.8.*||^6.0||^7.0||^8.0||^9.0||^10.0||^11.0||^12.0", + "php": "^7.0||^8.0", + "phpoffice/phpspreadsheet": "^1.30.0", + "psr/simple-cache": "^1.0||^2.0||^3.0" + }, + "require-dev": { + "laravel/scout": "^7.0||^8.0||^9.0||^10.0", + "orchestra/testbench": "^6.0||^7.0||^8.0||^9.0||^10.0", + "predis/predis": "^1.1" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "Excel": "Maatwebsite\\Excel\\Facades\\Excel" + }, + "providers": [ + "Maatwebsite\\Excel\\ExcelServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Maatwebsite\\Excel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Patrick Brouwers", + "email": "patrick@spartner.nl" + } + ], + "description": "Supercharged Excel exports and imports in Laravel", + "keywords": [ + "PHPExcel", + "batch", + "csv", + "excel", + "export", + "import", + "laravel", + "php", + "phpspreadsheet" + ], + "support": { + "issues": "https://github.com/SpartnerNL/Laravel-Excel/issues", + "source": "https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.67" + }, + "funding": [ + { + "url": "https://laravel-excel.com/commercial-support", + "type": "custom" + }, + { + "url": "https://github.com/patrickbrouwers", + "type": "github" + } + ], + "time": "2025-08-26T09:13:16+00:00" + }, + { + "name": "maatwebsite/laravel-nova-excel", + "version": "1.3.13", + "source": { + "type": "git", + "url": "https://github.com/SpartnerNL/Laravel-Nova-Excel.git", + "reference": "dd5f4c35b2c83b1f057e891483588f694850bc35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SpartnerNL/Laravel-Nova-Excel/zipball/dd5f4c35b2c83b1f057e891483588f694850bc35", + "reference": "dd5f4c35b2c83b1f057e891483588f694850bc35", + "shasum": "" + }, + "require": { + "laravel/nova": "^4.0|^5.0", + "laravie/serialize-queries": "^1.0|^2.0|^3.0", + "maatwebsite/excel": "^3.1.57", + "php": "^7.1||^8.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Maatwebsite\\LaravelNovaExcel\\LaravelNovaExcelServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Maatwebsite\\LaravelNovaExcel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Patrick Brouwers", + "email": "patrick@maatwebsite.nl" + } + ], + "description": "Supercharged Excel exports for Laravel Nova Resources", + "keywords": [ + "PHPExcel", + "actions", + "laravel", + "laravel-nova", + "nova", + "phpspreadsheet" + ], + "support": { + "issues": "https://github.com/SpartnerNL/Laravel-Nova-Excel/issues", + "source": "https://github.com/SpartnerNL/Laravel-Nova-Excel/tree/1.3.13" + }, + "time": "2025-05-15T09:44:24+00:00" + }, + { + "name": "maennchen/zipstream-php", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/maennchen/ZipStream-PHP.git", + "reference": "682f1098a8fddbaf43edac2306a691c7ad508ec5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/682f1098a8fddbaf43edac2306a691c7ad508ec5", + "reference": "682f1098a8fddbaf43edac2306a691c7ad508ec5", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-zlib": "*", + "php-64bit": "^8.3" + }, + "require-dev": { + "brianium/paratest": "^7.7", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.86", + "guzzlehttp/guzzle": "^7.5", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.5", + "phpunit/phpunit": "^12.0", + "vimeo/psalm": "^6.0" + }, + "suggest": { + "guzzlehttp/psr7": "^2.4", + "psr/http-message": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZipStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Duncan", + "email": "pabs@pablotron.org" + }, + { + "name": "Jonatan Männchen", + "email": "jonatan@maennchen.ch" + }, + { + "name": "Jesse Donat", + "email": "donatj@gmail.com" + }, + { + "name": "András Kolesár", + "email": "kolesar@kolesar.hu" + } + ], + "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", + "keywords": [ + "stream", + "zip" + ], + "support": { + "issues": "https://github.com/maennchen/ZipStream-PHP/issues", + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.2.1" + }, + "funding": [ + { + "url": "https://github.com/maennchen", + "type": "github" + } + ], + "time": "2025-12-10T09:58:31+00:00" + }, + { + "name": "markbaker/complex", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPComplex/issues", + "source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2" + }, + "time": "2022-12-06T16:21:08+00:00" + }, + { + "name": "markbaker/matrix", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "^4.0", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@demon-angel.eu" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPMatrix/issues", + "source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1" + }, + "time": "2022-12-02T22:17:43+00:00" + }, { "name": "monolog/monolog", "version": "3.10.0", @@ -3562,6 +4078,114 @@ }, "time": "2020-10-15T08:29:30+00:00" }, + { + "name": "phpoffice/phpspreadsheet", + "version": "1.30.2", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "09cdde5e2f078b9a3358dd217e2c8cb4dac84be2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/09cdde5e2f078b9a3358dd217e2c8cb4dac84be2", + "reference": "09cdde5e2f078b9a3358dd217e2c8cb4dac84be2", + "shasum": "" + }, + "require": { + "composer/pcre": "^1||^2||^3", + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "ezyang/htmlpurifier": "^4.15", + "maennchen/zipstream-php": "^2.1 || ^3.0", + "markbaker/complex": "^3.0", + "markbaker/matrix": "^3.0", + "php": ">=7.4.0 <8.5.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-main", + "doctrine/instantiator": "^1.5", + "dompdf/dompdf": "^1.0 || ^2.0 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.2", + "mitoteam/jpgraph": "^10.3", + "mpdf/mpdf": "^8.1.1", + "phpcompatibility/php-compatibility": "^9.3", + "phpstan/phpstan": "^1.1", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^8.5 || ^9.0", + "squizlabs/php_codesniffer": "^3.7", + "tecnickcom/tcpdf": "^6.5" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "ext-intl": "PHP Internationalization Functions", + "mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + }, + { + "name": "Owen Leibman" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "support": { + "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.30.2" + }, + "time": "2026-01-11T05:58:24+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.5", diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 4aa9c99..506ef4f 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -366,7 +366,7 @@ ## Step 10: Scoring and Result ## Step 11: Activity Logging -[ ] **Add append-only activity logging for analytics.** +[x] **Add append-only activity logging for analytics.** Create a logging service (or helper) that writes to the `logs` table. Integrate log writes into all relevant actions: `login`, `logout`, `screening_started`, `screening_completed`, `session_started`, `session_completed`, `session_abandoned`, `answer_saved`, `step_viewed`. Each log includes `user_id`, `session_id`, `category_id`, `action`, and `metadata` JSON as defined in `docs/technical-requirements.md` section 5 (logs table). The Log model should have no `updated_at` and should prevent updates/deletes. @@ -403,7 +403,7 @@ ## Step 11: Activity Logging ## Step 12: Nova Resources and Policies -[ ] **Create all Nova resources, policies, and Excel export actions.** +[x] **Create all Nova resources, policies, and Excel export actions.** Create Nova resources: `CategoryResource`, `QuestionGroupResource`, `QuestionResource`, `ScreeningResource`, `SessionResource`, `AnswerResource`, `LogResource`. Create corresponding policies enforcing the permission matrix from `docs/technical-requirements.md` section 9 (most are read-only; only Question.text is editable). Apply field behaviors: all fields filterable, sortable, and copyable where applicable. Set menu visibility (only Question, Screening, Session, Log appear in sidebar). Install `maatwebsite/laravel-nova-excel` and add `DownloadExcel` action to every resource.