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

Feat zmskvr 78 aufrufe in bearbeitung #887

Open
wants to merge 5 commits into
base: next
Choose a base branch
from

Conversation

MoDaae
Copy link
Collaborator

@MoDaae MoDaae commented Feb 17, 2025

Pull Request Checklist (Feature Branch to next):

  • Ich habe die neuesten Änderungen aus dem next Branch in meinen Feature-Branch gemergt.
  • Das Code-Review wurde abgeschlossen.
  • Fachliche Tests wurden durchgeführt und sind abgeschlossen.

Summary by CodeRabbit

  • New Features
    • The appointments panel now remembers its expanded or collapsed state across page reloads.
    • Queue items are now organized with refined filtering and enhanced sorting, ensuring a more intuitive display.
    • A new "Status" column has been added to the appointments table, using clear icons and text to indicate each appointment's current state.

Copy link
Contributor

coderabbitai bot commented Feb 17, 2025

Walkthrough

The changes update the queue management functionality across the system. The JavaScript module now conditionally handles and persists the withCalled parameter using localStorage and adjusts the UI accordingly. In addition, the PHP backend filters and sorts queue items by extending the status filter and introducing a custom sorting mechanism based on status and call time. Finally, the Twig template is updated to include a new "Status" column with icons reflecting different appointment statuses.

Changes

File(s) Summary
zmsadmin/js/block/queue/index.js
zmsadmin/templates/block/queue/table.twig
UI updates: Modified the load method to conditionally check the withCalled parameter, persist its state in localStorage, and update UI elements (toggling the 'active' class). Added a new "Status" column with icons representing called and processing statuses.
zmsadmin/src/Zmsadmin/QueueTable.php Backend changes: Updated the readResponse method by modifying the status filter from 'called' to 'called,processing' and implementing a custom sorting function based on a defined status order and descending call time.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant C as Client (JS)
    participant LS as LocalStorage
    participant S as Server (QueueTable)
    participant T as UI Template

    U->>C: Click #called-appointments
    C->>LS: Retrieve 'calledPanelOpen'
    C->>S: AJAX request (load queue list)
    S-->>C: Return filtered & sorted queue list
    C->>T: Render queue table with status column
    C->>LS: Update 'calledPanelOpen' state
Loading

Possibly related PRs

Suggested reviewers

  • ThomasAFink

Poem

I'm a rabbit, swift and bright,
Hopping through code with pure delight.
Saving states and toggling views,
Sorting queues with custom cues.
With icons shining in the light,
I cheer the changes, day and night! 🐰

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
zmsadmin/src/Zmsadmin/QueueTable.php (1)

72-82: LGTM! Well-structured sorting mechanism.

The sorting logic effectively prioritizes status order before call time, using a clear and maintainable approach. Consider extracting the status order array as a class constant for better maintainability.

 class QueueTable extends BaseController
 {
+    private const STATUS_ORDER = ['called' => 0, 'processing' => 1];
     protected $processStatusList = ['preconfirmed','confirmed', 'queued', 'reserved', 'deleted'];

     // ... other code ...

     $queueListCalled->uasort(function ($queueA, $queueB) {
-        $statusOrder = ['called' => 0, 'processing' => 1];
-        $cmp = $statusOrder[$queueA->status] <=> $statusOrder[$queueB->status];
+        $cmp = self::STATUS_ORDER[$queueA->status] <=> self::STATUS_ORDER[$queueB->status];
         if ($cmp !== 0) {
             return $cmp;
         }
         return $queueB->callTime <=> $queueA->callTime;
     });
zmsadmin/js/block/queue/index.js (2)

42-62: LGTM! State persistence implemented correctly.

The load method effectively handles state persistence using localStorage and updates the UI accordingly. Consider extracting the localStorage key as a constant to avoid magic strings.

 class View extends BaseView {
+    static STORAGE_KEY = 'calledPanelOpen';
     
     // ... other code ...
     
     load(withCalled = false) {
         if (withCalled === false) {
-            const storedState = localStorage.getItem('calledPanelOpen');
+            const storedState = localStorage.getItem(View.STORAGE_KEY);
             withCalled = (storedState === 'true');
         }
         
         const url = `${this.includeUrl}/queueTable/?selecteddate=${this.selectedDate}&withCalled=${withCalled ? 1 : 0}`;
         
         return this.loadContent(url, 'GET', null, null, this.showLoader)
             .then(() => {
-                const storedState = localStorage.getItem('calledPanelOpen');
+                const storedState = localStorage.getItem(View.STORAGE_KEY);
                 if (storedState === 'true') {
                     $('#called-appointments').addClass('active');
                     $('#called-appointments').next('.accordion-panel').css('display', 'block');

88-88: LGTM! Event handler updated for state persistence.

The state persistence in the click handler is consistent with the load method. Update to use the same constant for the localStorage key.

-            localStorage.setItem('calledPanelOpen', this.withCalled ? 'true' : 'false');
+            localStorage.setItem(View.STORAGE_KEY, this.withCalled ? 'true' : 'false');
zmsadmin/templates/block/queue/table.twig (1)

235-245: Add accessibility attributes to status icons.

The status cell implementation is well-structured with clear visual indicators. Consider adding ARIA labels for better accessibility.

                                 <td>
                                     <div style="display: flex; justify-content: center; align-items: center; height: 100%;">
                                         {% if item.status == 'called' %}
-                                            <i class="fas fa-tv" style="color: #0053b4;"></i>
+                                            <i class="fas fa-tv" style="color: #0053b4;" aria-label="Status: Called" role="img"></i>
                                         {% elseif item.status == 'processing' %}
-                                            <i class="fas fa-hourglass-half" style="color: #0053b4;"></i>
+                                            <i class="fas fa-hourglass-half" style="color: #0053b4;" aria-label="Status: Processing" role="img"></i>
                                         {% else %}
-                                            {{ item.status }}
+                                            <span role="status">{{ item.status }}</span>
                                         {% endif %}
                                     </div>
                                 </td>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 708c776 and 61b813f.

📒 Files selected for processing (3)
  • zmsadmin/js/block/queue/index.js (2 hunks)
  • zmsadmin/src/Zmsadmin/QueueTable.php (1 hunks)
  • zmsadmin/templates/block/queue/table.twig (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
zmsadmin/src/Zmsadmin/QueueTable.php (1)

67-67: LGTM! Status filter extended to include processing state.

The status filter now correctly includes both 'called' and 'processing' states, which aligns with the queue management enhancements.

zmsadmin/templates/block/queue/table.twig (1)

211-211: LGTM! Status column header added.

The Status column header is correctly added to the table.

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