Skip to content

Refactor personal log system with centralized service class and optimized display - #132

Merged
itshypax merged 10 commits into
updatefrom
copilot/update-personal-log-system
Nov 4, 2025
Merged

Refactor personal log system with centralized service class and optimized display#132
itshypax merged 10 commits into
updatefrom
copilot/update-personal-log-system

Conversation

Copilot AI commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Employee profile logs mixed hardcoded HTML strings and SQL across multiple files with magic numbers (0-7) for types. No structured data storage for log context. Comments and system logs were displayed together, making it difficult to focus on relevant information.

Changes

New PersonalLogManager service class

  • Centralizes all log operations (create, read, delete)
  • Type constants replace magic numbers: TYPE_NOTE, TYPE_RANK_CHANGE, TYPE_DOCUMENT, etc.
  • Specialized methods for common operations: logRankChange(), logQualificationChange(), etc.
  • Supports structured metadata via JSON column
  • New filtering methods: getComments() and getSystemLogs() for category-based retrieval

Database migration

  • Adds nullable metadata TEXT column to intra_mitarbeiter_log
  • Backward compatible with existing entries

Optimized display sections

  • Kommentare/Notizen section: Shows only manual comments/notes (types 0, 1, 2) - primary focus
  • Systemprotokoll section: Shows only auto-generated system logs (types 4, 5, 6, 7) - secondary section
  • System log positioned below comments in same column for compact layout
  • System log is collapsible and collapsed by default (HTML5 <details> element) to reduce visual clutter
  • Smart state management: System log automatically expands when logpage URL parameter is present for better navigation UX
  • Independent pagination for each section (page and logpage parameters)
  • Reduced styling for system log (smaller font, lighter background, compact padding)

Refactored files

  • mitarbeiter/profile.php - 6 hardcoded log insertions → service calls, optimized layout with collapsible system log (collapsed by default, auto-expands with logpage parameter)
  • mitarbeiter/create.php, comment-delete.php - service calls
  • assets/components/profiles/comments/main.php - displays only comments, uses getComments()
  • assets/components/profiles/logs/main.php - new file for system logs display
  • assets/functions/documents/create-custom.php - metadata support
  • assets/css/personal.css - compact styling for less prominent logs section

Example

Before:

$logContent = 'Dienstgrad wurde von <strong>' . $cdginfo['name'] . '</strong> auf <strong>' . $ndginfo['name'] . '</strong> geändert.';
$logStmt = $pdo->prepare("INSERT INTO intra_mitarbeiter_log (profilid, type, content, paneluser) VALUES (:id, '4', :content, :paneluser)");
$logStmt->execute([...]);

After:

$logManager->logRankChange($id, $cdginfo['name'], $ndginfo['name'], $edituser);

The service handles HTML escaping, prepared statements, and metadata automatically. All type codes preserved for compatibility.

Warning

<issue_title>Personal-Log überarbeiten</issue_title>
<issue_description>## Bezieht sich die Anfrage einer Funktion auf ein Problem? Bitte beschreiben.
Kommentare und Log-Einträge (im Mitarbeiter-Profil) sind in einer Tabelle gemeinsam vertreten. Log-Einträge werden dabei fest definiert und der gesamte Code für Verlinkungen oder Texte ist im Log selbst vorgegeben.

Beschreibung der gewünschten Lösung

Das System sollte überarbeitet werden, um technisch und funktionell auf neuerem Stand zu sein.

Zusätzlicher Kontext

//</issue_description>

Comments on the Issue (you are @copilot in this section)

<issue_title>Personal-Log überarbeiten</issue_title>

<issue_description>## Bezieht sich die Anfrage einer Funktion auf ein Problem? Bitte beschreiben.
Kommentare und Log-Einträge (im Mitarbeiter-Profil) sind in einer Tabelle gemeinsam vertreten. Log-Einträge werden dabei fest definiert und der gesamte Code für Verlinkungen oder Texte ist im Log selbst vorgegeben.

Beschreibung der gewünschten Lösung

Das System sollte überarbeitet werden, um technisch und funktionell auf neuerem Stand zu sein.

Zusätzlicher Kontext

//</issue_description>

Comments on the Issue (you are @copilot in this section)

<issue_title>Personal-Log überarbeiten</issue_title>

<issue_description>## Bezieht sich die Anfrage einer Funktion auf ein Problem? Bitte beschreiben.
Kommentare und Log-Einträge (im Mitarbeiter-Profil) sind in einer Tabelle gemeinsam vertreten. Log-Einträge werden dabei fest definiert und der gesamte Code für Verlinkungen oder Texte ist im Log selbst vorgegeben.

Beschreibung der gewünschten Lösung

Das System sollte überarbeitet werden, um technisch und funktionell auf neuerem Stand zu sein.

Zusätzlicher Kontext

//</issue_description>

Comments on the Issue (you are @copilot in this section)

<issue_title>Personal-Log überarbeiten</issue_title>

<issue_description>## Bezieht sich die Anfrage einer Funktion auf ein Problem? Bitte beschreiben.
Kommentare und Log-Einträge (im Mitarbeiter-Profil) sind in einer Tabelle gemeinsam vertreten. Log-Einträge werden dabei fest definiert und der gesamte Code für Verlinkungen oder Texte ist im Log selbst vorgegeben.

Beschreibung der gewünschten Lösung

Das System sollte überarbeitet werden, um technisch und funktionell auf neuerem Stand zu sein.

Zusätzlicher Kontext

//</issue_description>

Comments on the Issue (you are @copilot in this section)

Original prompt

This section details on the original issue you should resolve

<issue_title>Personal-Log überarbeiten</issue_title>
<issue_description>## Bezieht sich die Anfrage einer Funktion auf ein Problem? Bitte beschreiben.
Kommentare und Log-Einträge (im Mitarbeiter-Profil) sind in einer Tabelle gemeinsam vertreten. Log-Einträge werden dabei fest definiert und der gesamte Code für Verlinkungen oder Texte ist im Log selbst vorgegeben.

Beschreibung der gewünschten Lösung

Das System sollte überarbeitet werden, um technisch und funktionell auf neuerem Stand zu sein.

Zusätzlicher Kontext

//</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 4, 2025 04:23
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Copilot AI changed the title [WIP] Update personal log for modern functionality Refactor personal log system with centralized service class Nov 4, 2025
Copilot AI requested a review from itshypax November 4, 2025 04:33
@itshypax

itshypax commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

@copilot Now the log and comments should be separated in display so comments can be viewed with a better focus

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Now the log and comments should be separated in display so comments can be viewed with a better focus

Done in commit 056d89f.

The display is now separated into two sections:

Kommentare/Notizen - Manual comments and notes (types 0, 1, 2)

  • User-created entries only
  • Can be deleted by admins
  • Independent pagination with ?page= parameter

Systemprotokoll - Auto-generated system logs (types 4, 5, 6, 7)

  • Rank changes, profile modifications, document creation, etc.
  • Permanent audit trail
  • Independent pagination with ?logpage= parameter

The PersonalLogManager now has getComments() and getSystemLogs() methods to filter entries by category, giving better focus to each type of information.

Copilot AI changed the title Refactor personal log system with centralized service class Refactor personal log system with centralized service class and separated display Nov 4, 2025
@itshypax

itshypax commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

@copilot Die Darstellung des Systemprotokolls sollte weniger prägnant sein, es ist sehr groß und "störend". Entweder es muss etwas nebensächlicher werden oder es muss neben oder unter den Kommentaren angezeigt werden

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Die Darstellung des Systemprotokolls sollte weniger prägnant sein, es ist sehr groß und "störend". Entweder es muss etwas nebensächlicher werden oder es muss neben oder unter den Kommenta...

Done in commit 6283ad7.

The system log is now less prominent and positioned below the comments in the same column:

Layout changes:

  • System log moved from full-width row to below comments section
  • Now uses collapsible <details> element (can be collapsed/expanded)
  • Smaller heading (h5 instead of h4)

Visual styling:

  • Lighter background color (secondary background)
  • Reduced font size (0.9rem vs 1rem)
  • Reduced padding (8px vs 10px)
  • More compact spacing between entries

The system log is now much less visually dominant while remaining accessible when needed. Users can collapse it entirely to focus solely on comments.

Copilot AI changed the title Refactor personal log system with centralized service class and separated display Refactor personal log system with centralized service class and optimized display Nov 4, 2025
@itshypax

itshypax commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

@copilot Can you make it so the summary is closed by default

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Can you make it so the summary is closed by default

Done in commit 07dfa8a. The system log section is now collapsed by default - removed the open attribute from the <details> element. Users need to click on "Systemprotokoll" to expand and view the system logs.

@itshypax

itshypax commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

@copilot If &logpage=X then the summary should be open

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

@copilot If &logpage=X then the summary should be open

Done in commit 6c63c5d. The system log section now automatically opens when the logpage parameter is present in the URL. This provides a better user experience - when users click on log pagination links, the section stays open to show the requested log page.

@itshypax
itshypax marked this pull request as ready for review November 4, 2025 05:02
@itshypax
itshypax merged commit 7a68a50 into update Nov 4, 2025
@itshypax
itshypax deleted the copilot/update-personal-log-system branch November 4, 2025 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants