Build out admin Add to Event Log page #75

Open
opened 2026-05-07 20:45:34 -05:00 by jimmyb · 0 comments
Owner

The /admin/event-logs/create page should become a staff workflow for manually adding an event log entry to the admin dashboard. Staff need a validated form for recording operational notes or manual events that should appear alongside system-generated activity entries.

The current Laravel checkout has an admin Add to Event Log route, sidebar entry, and placeholder view. The admin dashboard already displays recent event logs from Spatie's activity_log table via Spatie\Activitylog\Models\Activity, so this issue should either write manual entries into that same activity log with a clear log_name/event convention or explicitly define a separate manual event-log model if that is preferred.

Scope

  • Replace the current /admin/event-logs/create placeholder with a real manual event log form.
  • Confirm whether manual entries use Spatie activity_log or a dedicated event-log table.
  • Capture a clear event title/description, optional event type/category, and optional subject/context where appropriate.
  • Attribute the entry to the staff user who created it.
  • Show manual entries in the dashboard event log feed using existing event-log rendering.
  • Validate all submitted fields server-side.
  • Use existing admin form styling, submit-lock behavior, validation feedback, and success messages.
  • Prevent manual event creation by users outside the allowed staff/content-management roles.

Acceptance Criteria

  • Authorized staff can visit /admin/event-logs/create and see a real form instead of the placeholder.
  • Users without the required staff role cannot access or submit the form.
  • The form requires a description/body for the event log entry.
  • Optional event/category fields, if included, are validated against allowed values.
  • Submitting valid data creates a manual event log entry attributed to the current staff user.
  • The created entry appears in the admin dashboard Event Logs panel.
  • The created entry is distinguishable from automated activity entries by log name, event type, or description convention.
  • Validation errors return clear feedback without creating an event.
  • Successful creation redirects with success feedback and does not double-submit when submit-lock is active.
  • The page follows existing admin dashboard styling and supports light/dark mode.

Test Coverage Required

  • Feature test confirming authorized staff can render /admin/event-logs/create.
  • Authorization tests confirming insufficient-role users cannot access or submit manual event logs.
  • Feature test confirming a valid submission creates the expected event log record.
  • Validation tests for missing description and invalid optional fields.
  • Feature test confirming the created manual entry appears on the admin dashboard event log panel.
  • Feature test confirming actor/staff attribution is stored.
  • View assertion confirming the placeholder text is replaced by the creation form and submit-lock behavior.
  • Regression test confirming existing automated activity-log dashboard entries still render.
  • Tests should use Pest and focused feature coverage.
  • Run the focused affected tests, then run vendor/bin/pint --dirty --format agent before closing the issue.

Progress Checklist

  • Admin Add to Event Log route exists
  • Admin sidebar links to Add to Event Log
  • Add to Event Log placeholder view exists
  • Admin dashboard reads recent entries from activity_log
  • Spatie activity log table exists
  • Decide whether manual entries use activity_log or a separate model/table
  • Define manual event log fields and allowed event/category values
  • Replace the placeholder with a validated creation form
  • Persist actor/staff attribution
  • Ensure manual entries render in the dashboard Event Logs panel
  • Add success and validation feedback plus submit-lock protection
  • Add tests for access control, form rendering, validation, persistence, attribution, dashboard visibility, and automated-log regression
  • Confirm staff can create a manual event log entry end to end
The `/admin/event-logs/create` page should become a staff workflow for manually adding an event log entry to the admin dashboard. Staff need a validated form for recording operational notes or manual events that should appear alongside system-generated activity entries. The current Laravel checkout has an admin Add to Event Log route, sidebar entry, and placeholder view. The admin dashboard already displays recent event logs from Spatie's `activity_log` table via `Spatie\Activitylog\Models\Activity`, so this issue should either write manual entries into that same activity log with a clear `log_name`/event convention or explicitly define a separate manual event-log model if that is preferred. ## Scope - Replace the current `/admin/event-logs/create` placeholder with a real manual event log form. - Confirm whether manual entries use Spatie `activity_log` or a dedicated event-log table. - Capture a clear event title/description, optional event type/category, and optional subject/context where appropriate. - Attribute the entry to the staff user who created it. - Show manual entries in the dashboard event log feed using existing event-log rendering. - Validate all submitted fields server-side. - Use existing admin form styling, submit-lock behavior, validation feedback, and success messages. - Prevent manual event creation by users outside the allowed staff/content-management roles. ## Acceptance Criteria - Authorized staff can visit `/admin/event-logs/create` and see a real form instead of the placeholder. - Users without the required staff role cannot access or submit the form. - The form requires a description/body for the event log entry. - Optional event/category fields, if included, are validated against allowed values. - Submitting valid data creates a manual event log entry attributed to the current staff user. - The created entry appears in the admin dashboard Event Logs panel. - The created entry is distinguishable from automated activity entries by log name, event type, or description convention. - Validation errors return clear feedback without creating an event. - Successful creation redirects with success feedback and does not double-submit when submit-lock is active. - The page follows existing admin dashboard styling and supports light/dark mode. ## Test Coverage Required - Feature test confirming authorized staff can render `/admin/event-logs/create`. - Authorization tests confirming insufficient-role users cannot access or submit manual event logs. - Feature test confirming a valid submission creates the expected event log record. - Validation tests for missing description and invalid optional fields. - Feature test confirming the created manual entry appears on the admin dashboard event log panel. - Feature test confirming actor/staff attribution is stored. - View assertion confirming the placeholder text is replaced by the creation form and submit-lock behavior. - Regression test confirming existing automated activity-log dashboard entries still render. - Tests should use Pest and focused feature coverage. - Run the focused affected tests, then run `vendor/bin/pint --dirty --format agent` before closing the issue. ## Progress Checklist - [x] Admin Add to Event Log route exists - [x] Admin sidebar links to Add to Event Log - [x] Add to Event Log placeholder view exists - [x] Admin dashboard reads recent entries from `activity_log` - [x] Spatie activity log table exists - [ ] Decide whether manual entries use `activity_log` or a separate model/table - [ ] Define manual event log fields and allowed event/category values - [ ] Replace the placeholder with a validated creation form - [ ] Persist actor/staff attribution - [ ] Ensure manual entries render in the dashboard Event Logs panel - [ ] Add success and validation feedback plus submit-lock protection - [ ] Add tests for access control, form rendering, validation, persistence, attribution, dashboard visibility, and automated-log regression - [ ] Confirm staff can create a manual event log entry end to end
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MyVideoGameList/myvideogamelist.com#75
No description provided.