Ini 989#2312
Open
andiferdiawan wants to merge 41 commits into
Open
Conversation
Add NotificationType and UserNotificationSetting models with their respective migrations. These models support configurable notification channels and user-specific settings with polymorphic scoping.
Add observer to send notifications to active staff users when an order state changes Create OrderStateUpdated notification class with database channel support Seed notification type for order state updates Add HasNotificationSettings trait to User model for notification preferences Simplify notification settings retrieval logic in trait
…e UI updates - Extend BroadcastUserNotification to handle Order model with custom route and slug - Update Echo store to process notifications and add them to layout structure - Improve notification badge to show count and limit to 9+
Implement GetUnreadNotifications action to retrieve paginated unread notifications for the authenticated user. The action returns both the notification list and total unread count, improving the UI's ability to display notification badges and lists efficiently.
Instead of adding a mock notification to the layout structure, fetch the actual unread notifications from the API. This ensures the notification list reflects the true server state in real-time.
Add a new GET route for retrieving unread user notifications, enabling the UI to display them.
Implement method to check if a user should receive a notification based on enabled status and payload filters. This allows for more granular control over notification delivery by evaluating filter rules against payload data.
Add a new action to create or update user notification settings. This allows users to enable/disable notifications, select channels, and set filters per notification type with optional scoping.
Previously, the notification was sent to all users regardless of their or their guests' status. This change filters users to only those with active status and at least one active guest, ensuring notifications are relevant.
…ification Previously, the second query would overwrite the first, causing only guest users to receive notifications. This change merges both user lists and removes duplicates to ensure all active staff and guest users are notified.
The column names in the whereHas subqueries were ambiguous, which could cause SQL errors in certain database configurations. Explicitly qualifying with the table name ensures reliable query execution.
Update notification title and body text for premium dispatch orders to accurately reflect their priority status. This ensures users receive clear and appropriate notifications when order state changes.
Add the created_at timestamp to the NotificationResource's toArray method to provide the notification's creation time in API responses.
… notifications Add conditional logic to generate appropriate routes for PalletDelivery and PalletReturn instances in broadcast notifications. This ensures users receive correct links when notifications are triggered for these fulfilment entities. The slug property is also now consistently included in the base data array.
Prevent sending notifications to staff when the order state changes for non-premium dispatch orders to avoid unnecessary alerts.
Add a new navigation item for notification settings under the system admin section, allowing administrators to access user notification configuration.
Add GetNotificationStateOptions to retrieve order state options for ordering notification types. Add GetUsersNotificationSettingOptions to fetch user, group, organisation, shop, and notification type options for notification settings UI.
Update anonymous class declarations in migration files to use parentheses for consistency. Also add notification settings routes to sysadmin web routes.
- Introduce trait for notification sub-navigation - Create action to store user notification settings with scope support - Implement action to list and paginate user notification settings - Add Vue page for displaying and managing user notification settings
…settings - Add delete route and action for user notification settings - Enhance store action to support editing and return redirect response - Add global search and enable/disable toggle in index view - Add artisan command to seed default notification settings for users
Add CRUD routes for guest notification settings to match existing user notification functionality. This enables sysadmins to manage notification preferences for guest users separately.
- Add new sub-navigation entry for guest settings - Implement CRUD actions for guest notification settings (index, store, delete) - Add options provider for guest users, groups, organisations, shops, and notification types - Create Vue page for managing guest notification settings with table and modal forms - Support scoped settings (group, organisation, shop) and state filters
…ests Add new Artisan command `notification:seed-default-guest-notifications` to create default notification settings for active guest users. The command includes options to force overwrite existing settings or reset the entire table, and handles foreign key constraints across different database drivers (PostgreSQL, SQLite, MySQL/MariaDB). It also cleans up stale settings for inactive guests. Remove outdated comment about defaulting to MySQL/MariaDB in the existing user notification seeder.
Add routes for managing notification types: index, store, update, and delete. This enables sysadmins to configure custom notification categories.
- Introduce NotificationChannelEnum to define available notification channels - Add Create, Read, Update, Delete actions for notification types - Create Vue page to manage notification types with table and modal forms - Extend notification settings navigation to include types section
Replace inline user query logic in OrderObserver with a dedicated service. This centralizes recipient resolution logic, supports configurable notification settings per user, and enables hierarchical scoping (global/group/org/shop) with state-based filtering.
Clarify that scope can be Global/Group in addition to Shop/Organization.
Add new UI component for managing user notification settings in profile. Include backend actions to update preferences and fetch state options.
…ications Prevent showing toast notifications when there are no new unread notifications. This avoids unnecessary UI interruptions and ensures toasts are only displayed when there is actual new content for the user.
The isDirty method checks if an attribute has changed in the current request cycle but hasn't been saved yet, while wasChanged checks if an attribute was changed during the last save operation. Since we're in the updated observer (after save), wasChanged is the correct method to determine if the state attribute was actually modified in the database.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Notification Features

Scope User Notification Setting

Type Notifications

run this order type of notification
php artisan db:seed --class=OrderingNotificationSeeder
default to run scope user/guest setting notification
for Guest run seeder
php artisan notification:seed-default-guest-notifications
for User run seeder
php artisan notification:seed-default-user-notifications