Skip to content

Add form actions for creating and canceling tickets#114

Closed
dsFejerA wants to merge 1 commit intopelican-dev:mainfrom
dsFejerA:dsFejerA-patch-createTicket
Closed

Add form actions for creating and canceling tickets#114
dsFejerA wants to merge 1 commit intopelican-dev:mainfrom
dsFejerA:dsFejerA-patch-createTicket

Conversation

@dsFejerA
Copy link

@dsFejerA dsFejerA commented Feb 24, 2026

Quick fix for CreateTicket in server area.

Summary by CodeRabbit

  • New Features
    • Enhanced the ticket creation form interface with proper action buttons. A primary create button allows users to submit and save new tickets, while a visually distinct cancel button provides an easy way to dismiss the form and return to the ticket list. This improves the overall usability of the ticket creation workflow.

Quick fix for CreateTicket in server area.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

The CreateTicket page now includes a custom form actions method that defines two buttons: a primary create action that submits the form, and a secondary cancel action that returns to the resource list.

Changes

Cohort / File(s) Summary
Form Actions Definition
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php
Added new getFormActions() method defining a primary create button and a secondary gray cancel button linking back to the resource URL. Includes import of Filament\Actions\Action.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 With buttons now defined, both create and dismiss,
The ticket form flows just like this—
Submit to persist, or cancel to flee,
Actions designed with simplicity!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding form actions (create and cancel buttons) to the CreateTicket page, which matches the code modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 1

🧹 Nitpick comments (1)
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php (1)

20-35: Optional: Use Filament's built-in getCreateFormAction() instead of reimplementing it.

The create action is a verbatim reimplementation of what parent::getCreateFormAction() already returns. Delegating to it removes the coupling to internal translation key strings and keeps the action in sync with future Filament updates.

♻️ Proposed refactor
     protected function getFormActions(): array
     {
         return [
-            Action::make('create')
-                ->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'))
-                ->submit('create')
-                ->color('primary')
-                ->button(),
-
+            parent::getCreateFormAction(),
             Action::make('cancel')
                 ->label(__('filament-panels::resources/pages/edit-record.form.actions.cancel.label'))
                 ->url($this->getResource()::getUrl())
                 ->color('gray')
                 ->button(),
         ];
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php` around
lines 20 - 35, Replace the manual creation of the "create" Action in
getFormActions() with Filament's built-in one by calling
parent::getCreateFormAction() (leave the existing "cancel" Action as-is);
specifically, locate the getFormActions method and swap out the
Action::make('create') block for parent::getCreateFormAction() so you rely on
the framework-provided create action instead of reimplementing it.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php`:
- Line 28: Remove the trailing whitespace on the blank line in CreateTicket.php
that sits between the two Action chains; open the CreateTicket class file and
delete the extra spaces on the empty line separating the chained ->actions(...)
calls so the file has a truly empty line (no trailing spaces) and Pint CI will
pass.

---

Nitpick comments:
In `@tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php`:
- Around line 20-35: Replace the manual creation of the "create" Action in
getFormActions() with Filament's built-in one by calling
parent::getCreateFormAction() (leave the existing "cancel" Action as-is);
specifically, locate the getFormActions method and swap out the
Action::make('create') block for parent::getCreateFormAction() so you rely on
the framework-provided create action instead of reimplementing it.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f80b95d and 0996e94.

📒 Files selected for processing (1)
  • tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php
📜 Review details
🧰 Additional context used
🧬 Code graph analysis (1)
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php (3)
tickets/src/Filament/Admin/Resources/Tickets/Pages/CreateTicket.php (1)
  • getFormActions (27-30)
tickets/src/Filament/Admin/Resources/Tickets/Pages/EditTicket.php (1)
  • getFormActions (33-36)
legal-pages/src/Enums/LegalPageType.php (1)
  • getUrl (27-30)
🪛 GitHub Actions: Lint
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php

[error] 1-1: Pint style check failed. 1 style issue detected in Laravel project (vendor/bin/pint --test).

🔇 Additional comments (2)
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php (2)

7-7: LGTM — correct import for page-level form actions.


29-33: No action needed. The translation key filament-panels::resources/pages/create-record.form.actions.cancel.label exists in Filament v3's create-record.php translation file. The code at lines 29-33 is correct and uses the proper translation key for the cancel button.

->submit('create')
->color('primary')
->button(),

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix trailing whitespace — this is causing the Pint CI failure.

Line 28 (the blank line between the two Action chains) has trailing whitespace, which is the one style issue flagged by Pint. Remove the whitespace to fix the pipeline.

🧹 Proposed fix
             Action::make('create')
                 ->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'))
                 ->submit('create')
                 ->color('primary')
                 ->button(),
-            
+
             Action::make('cancel')
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php` at line
28, Remove the trailing whitespace on the blank line in CreateTicket.php that
sits between the two Action chains; open the CreateTicket class file and delete
the extra spaces on the empty line separating the chained ->actions(...) calls
so the file has a truly empty line (no trailing spaces) and Pint CI will pass.

@Boy132
Copy link
Member

Boy132 commented Feb 24, 2026

See 47f93e0

@Boy132 Boy132 closed this Feb 24, 2026
@dsFejerA dsFejerA deleted the dsFejerA-patch-createTicket branch February 24, 2026 10:58
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