Commit Graph

8640 Commits

Author SHA1 Message Date
Lorenz Hilpert
f3d5466f81 feat: add NgRx Resource API and Angular effects alternatives skills
Add two new skills based on Angular Architects articles:

1. ngrx-resource-api: Guide for integrating Angular's Resource API with
   NgRx Signal Store for reactive data management without RxJS
   - withProps pattern for dependency injection
   - Resource configuration and lifecycle
   - Error handling and computed derivations
   - Common patterns and best practices

2. angular-effects-alternatives: Guide for proper effect() usage and
   declarative alternatives to prevent anti-patterns
   - Valid use cases (logging, canvas, imperative APIs)
   - Anti-patterns to avoid (state propagation, synchronization)
   - Decision tree for choosing alternatives
   - Refactoring patterns and code review checklist

Both skills follow modern Angular patterns and promote declarative,
maintainable code aligned with reactive principles.
2025-11-20 15:46:50 +01:00
Lorenz Hilpert
3e960b0f44 ♻️ refactor: improve ResponseArgs validation with Zod schema
- Replace manual type checking with Zod schema validation in isResponseArgs helper
- Simplify error handling logic in catchResponseArgsErrorPipe operator
- Remove redundant conditional checks by leveraging Zod's safeParse
- Remove unused ResponseArgs import from operator file

This improves type safety and validation robustness by using a declarative schema-based approach.
2025-11-20 15:22:16 +01:00
Nino Righi
17cb0802c3 Merged PR 2033: Add, Lock, Unlock Customer Cards
Add, Lock, Unlock Customer Cards

Refs: #5313, #5329, #5334, #5335
2025-11-20 13:59:27 +00:00
Lorenz Hilpert
b7d008e339 Merged PR 2032: Bugfix Bon Error Message
Related work items: #5314
2025-11-19 15:18:26 +00:00
Lorenz Hilpert
ceaf6dbf3c 📝 docs: add mandatory skill usage guidelines for reliable proactive invocation
Add critical section to CLAUDE.md covering:
- Skill vs Agent vs Direct Tools decision matrix
- Mandatory skill invocation rules with trigger conditions
- Proactive usage framework with right/wrong examples
- Skill chaining and coordination patterns
- Context management for skills (load → apply → unload)
- Failure handling for skill conflicts
- Decision tree for tool selection
2025-11-19 14:31:12 +01:00
Lorenz Hilpert
0f171d265b 📝 docs: add comprehensive context management guidelines for subagent usage
Add critical sections to CLAUDE.md covering:
- Context preservation rules to prevent bloat
- Agent invocation patterns (sequential/parallel/escalation)
- Result handling and synthesis guidelines
- Edge case handling (failures, timeouts, conflicts)
- Model selection criteria (Haiku vs Sonnet)
- Resume vs fresh agent decision framework
- Result validation and confidence communication
- Debug mode and special scenarios
- Performance degradation handling
- Caching strategies and priority conflict resolution
2025-11-19 14:31:12 +01:00
Lorenz Hilpert
fc6d29d62f Merged PR 2031: feat(crm): add customer bon redemption feature
feat(crm): add customer bon redemption feature

- New library @isa/crm/feature/customer-bon-redemption
- Implement bon validation and redemption flow
- Add SignalStore for state management
- Add resource pattern for reactive data loading
- Add facade for business logic abstraction
- Add Zod schemas for runtime validation
- Integrate with loyalty card API endpoints
- Add accessibility and E2E test attributes
- Remove mock provider (use real facade)
- Exclude generated swagger files from linting

Components:
- BonInputFieldComponent - input with validation
- BonDetailsDisplayComponent - shows validated bon
- BonRedemptionButtonComponent - redemption action

Data Access:
- CustomerBonRedemptionFacade - business logic
- CustomerBonCheckResource - reactive validation
- BonRedemptionStore - component state
- CrmSearchService - API integration (checkBon, addBon)

Issue: 5314

Related work items: #5314
2025-11-19 12:51:58 +00:00
Nino
8c0de558a4 feature(crm-customer-card): Improvements, Refresh Transactions
Refs: #5316, #5315
2025-11-18 16:44:54 +01:00
Nino
8b62fcc695 chore(package-lock): Update lock file, fixing build errors 2025-11-18 12:11:31 +01:00
Nino Righi
a855e79196 Merged PR 2030: feat(crm-customer-booking): add loyalty card booking component
feat(crm-customer-booking): add loyalty card booking component

Implement new component for customer loyalty card credit/debit bookings with booking type selection and real-time transaction updates. Includes automatic reload of transaction history after successful bookings.

Key changes:
- Add CrmFeatureCustomerBookingComponent with booking form UI
- Create CustomerCardBookingFacade for booking API calls
- Add CustomerBookingReasonsResource for loading booking types
- Extend CrmSearchService with booking methods (addBooking, fetchBookingReasons, fetchCurrentBookingPartnerStore)
- Add AddBookingSchema with Zod validation
- Integrate component into KundenkarteMainViewComponent
- Update CustomerCardTransactionsResource to providedIn: 'root' for shared access
- Improve transaction list UX (hide header/center empty state when no data)

Technical details:
- New library: @isa/crm/feature/customer-booking (Vitest-based)
- Signals-based state management with computed properties
- Automatic points calculation based on booking type multiplier
- Error handling with feedback dialogs
- 500ms delay before transaction reload to ensure API consistency
- Data attributes for E2E testing (data-what, data-which)

Ref: #5315
2025-11-18 10:05:17 +00:00
Nino Righi
71af23544f Merged PR 2029: feature(crm, isa-app-customer-search): Adjustments to Card Transaction Histor...
feature(crm, isa-app-customer-search): Adjustments to Card Transaction History, Added Scroll Top Button, Show 50 last Transactions, Wording changes
Refs: #5316
2025-11-18 09:58:26 +00:00
Lorenz Hilpert
e654a4d95e Merged PR 2028: Commit 86563a73: feat(crm): add customer card transactions history feature
Commit 86563a73:  feat(crm): add customer card transactions history feature

Implements #5316 - Service Portal History displaying last 5 loyalty card transactions

**New feature library:**
- Created @isa/crm/feature/customer-card-transactions with CDK table component
- Shows transactions for first activated customer loyalty card
- Displays: Date, Transaction type (reason), Amount (EUR), Receipt number, Points

**Data layer:**
- Added CustomerCardTransactionsResource with reactive resource pattern
- Extended CrmSearchService with fetchLoyaltyBookings() method
- Uses LoyaltyCardService.LoyaltyCardListBookings() API endpoint

**UI/UX:**
- CDK table with ISA design system colors
- Header: 48px height, rounded corners (26px), neutral-400 background
- Visual indicators: Green up arrow (EARN), Red down arrow (BURN)
- German locale formatting (dd.MM.yyyy HH:mm.ss)
- Full-width table layout with proper spacing (24px between rows)
- Empty state when no transactions available

**Icons:**
- Added isaActionPolygonUp and isaActionPolygonDown to @isa/icons

**Integration:**
- Integrated into kundenkarte-main-view component
- Automatically loads transactions for first active card

Related work items: #5316
2025-11-14 13:09:58 +00:00
Lorenz Hilpert
5057d56532 Merged PR 2026: feat(crm): add customer loyalty cards feature with points summary
Related work items: #5312
2025-11-14 12:59:02 +00:00
Nino
70ded96858 Merge branch 'release/4.4' into develop 2025-11-14 10:56:11 +01:00
Nino
7c2c72745f feature(checkout-reward): Enable Delivery Options 2025-11-14 10:55:05 +01:00
Nino
2ea76b6796 fix(core-tabs): Create Shopping Cart Correctly
Ref: #5480
2025-11-13 17:48:11 +01:00
Nino Righi
83292836a3 Merged PR 2027: #5483 Reset Reward Cart + Customer from Tab
#5483 Reset Reward Cart + Customer from Tab

Small Bugfixes to #5480 Customer clearing Logic
2025-11-13 15:49:49 +00:00
Nino Righi
212203fb04 Merged PR 2025: fix(core-tabs): improve tab cleanup and naming logic
fix(core-tabs): improve tab cleanup and naming logic

Refactor tab management to handle checkout state transitions more reliably:

- Extract helpers (formatCustomerTabNameHelper, checkCartHasItemsHelper,
  getNextTabNameHelper) from checkout component to @isa/core/tabs for reuse
- Fix getNextTabNameHelper to count tabs instead of finding max ID,
  preventing gaps in "Vorgang X" numbering
- Add canDeactivateTabCleanup guard to manage tab context based on cart state:
  * Preserves customer context if either cart (regular or reward) has items
  * Updates tab name with customer/organization name when context preserved
  * Resets tab to clean "Vorgang X" state when both carts empty
  * Handles navigation to global areas (without tab ID) gracefully
- Apply canDeactivateTabCleanup to checkout-summary and reward-order-confirmation routes
- Move tab cleanup logic from component ngOnDestroy to reusable guard
- Add comprehensive unit tests for getNextTabNameHelper

This ensures tabs maintain correct state after order completion, properly
display customer context when carts have items, and reset cleanly when
both carts are empty. The guard approach centralizes cleanup logic and
makes it reusable across checkout flows.

Ref: #5480
2025-11-13 14:10:43 +00:00
Lorenz Hilpert
b89cf57a8d fix(tabs): fix tab activation issue 2025-11-12 20:56:53 +01:00
Lorenz Hilpert
b70f2798df fix(auth): Use Angular Router for post-auth redirects
Replace window.location.href with Router.navigateByUrl() to ensure proper Angular navigation flow after authentication, maintaining state and avoiding full page reloads.
2025-11-12 15:58:38 +01:00
Lorenz Hilpert
0066e8baa1 fix(config): Update ISA API endpoint to test environment
Change @swagger/isa rootUrl from isa-feature to isa-test environment
to resolve KulturPass voucher redemption infinite loading issue.

Fixes #5474
2025-11-12 15:55:23 +01:00
Lorenz Hilpert
999f61fcc0 Merged PR 2023: fix(core/tabs): Add logging and fix critical bugs in TabService
fix(core/tabs): Add logging and fix critical bugs in TabService

- Add comprehensive logging using @isa/core/logging for all TabService methods
- Fix null pointer in patchTab when tab doesn't exist
- Fix activateTab allowing non-existent tabs to be set as active
- Fix removeTab not clearing activatedTabId when removing active tab
- Replace unsafe 'as any' type casts with proper type checking
- Document side effect in getCurrentLocation method

Fixes #5474

Related work items: #5474
2025-11-12 13:39:50 +00:00
Nino
b827a6f0a0 fix(isa-app): Fixes Auth and TabID Errors on Startup
Refs: #5472, #5473
2025-11-12 12:40:59 +01:00
Lorenz Hilpert
29b6091a30 chore: update MCP configuration and add Nx guidelines
- Update nx-mcp command format in .mcp.json
- Add Nx configuration section to CLAUDE.md
- Create AGENTS.md with Nx guidelines
- Improve formatting in CLAUDE.md
2025-11-12 12:09:04 +01:00
Nino
989294cc90 chore(azure-pipelines): Version Bump 2025-11-12 11:38:55 +01:00
Nino
c643d988fa Merge branch 'release/4.3' 4.3 2025-11-11 21:56:00 +01:00
Nino
463e46e17a chore(azure-pipelines, package-lock): Version Bump 2025-11-11 16:41:29 +01:00
Nino
c98d5666a4 fix(checkout-completion-orchestrator): Added Feedback Error Dialog 2025-11-11 16:07:50 +01:00
Nino
835546a799 feat(reward-purchasing-options): Disable Delivery Options 2025-11-11 15:18:38 +01:00
Lorenz Hilpert
f261fc9987 Merged PR 2021: feat(pickup-shelf): display Prämie label and Lesepunkte for reward items
feat(pickup-shelf): display Prämie label and Lesepunkte for reward items

- Add "Prämie" ui-label badge below product images in both list and details views
- Display Lesepunkte value instead of price for reward items
- Update getOrderItemRewardFeature helper to use structural typing for better type flexibility
- Apply to pickup-shelf-details-item and pickup-shelf-list-item components

Fixes #5467
2025-11-11 14:15:41 +00:00
Lorenz Hilpert
cc186dbbe2 Merged PR 2022: fix(checkout): prevent duplicate tasks in open reward carousel
Related work items: #5468
2025-11-11 14:15:05 +00:00
Nino Righi
6df02d9e86 Merged PR 2020: feat(confirmation-list-item-action-card): improve action card visibility logi...
feat(confirmation-list-item-action-card): improve action card visibility logic and add ordered state

Enhance the action card display logic to show only when both feature flag
and command/completion conditions are met. Add support for "Ordered" state
to distinguish pending items from completed ones.

Changes:
- Add hasLoyaltyCollectCommand helper to check for LOYALTY_COLLECT_COMMAND
- Update displayActionCard logic to require both Rücklage feature AND
  (loyalty collect command OR completion state)
- Add ProcessingStatusState.Ordered to distinguish ordered vs completed items
- Update isComplete to exclude ordered items from completion state
- Move role-based visibility check to outer container level
- Remove unused CSS class for completed state
- Add comprehensive unit tests for new helpers

The action card now correctly appears only for items that need user action,
hiding for CallCenter role and for items without the required commands.

Ref: #5459
2025-11-11 12:16:17 +00:00
Lorenz Hilpert
4a7b74a6c5 Merged PR 2018: add reward points (Prämie) display and label
Related work items: #5413
2025-11-11 09:48:26 +00:00
Lorenz Hilpert
9c989055cb Merged PR 2019: fix(customer-details): prioritize cart navigation over reward return URL
fix(customer-details): prioritize cart navigation over reward return URL

Fixes issue #5461 where navigating to cart after customer selection would
incorrectly route to reward shop page. Changed navigation priority to check
for regular shopping cart items before checking for reward return URL context.

This ensures that active standard checkout flows take precedence over any
lingering reward flow navigation context.

Related work items: #5461
2025-11-11 09:09:29 +00:00
Lorenz Hilpert
2e0853c91a Merged PR 2016: feat(core/auth): add type-safe role-based authorization library
feat(core/auth): add type-safe role-based authorization library

Created @isa/core/auth library with comprehensive role checking:
- RoleService for programmatic hasRole() checks
- IfRoleDirective for declarative *ifRole/*ifNotRole templates
- Type-safe Role enum (CallCenter, Store)
- TokenProvider abstraction with OAuth2 integration
- Signal-based reactive rendering with Angular effects
- Zero-configuration setup via InjectionToken factory

Fixed Bug #5451:
- Hide action buttons for HSC (CallCenter) users on reward order confirmation
- Applied *ifNotRole="Role.CallCenter" to actions container
- Actions now hidden while maintaining card visibility

Testing:
- 18/18 unit tests passing with Vitest
- JUnit and Cobertura reporting configured
- Complete test coverage for role checking logic

Documentation:
- Comprehensive README (817 lines) with API reference
- Usage examples and architecture diagrams
- Updated library-reference.md (62→63 libraries)

Technical:
- Handles both string and array JWT role formats
- Integrated with @isa/core/logging
- Standalone directive (no module imports)
- Full TypeScript type safety

Closes #5451

Related work items: #5451
2025-11-10 17:00:39 +00:00
Nino
c5ea5ed3ec Merge branch 'develop' of https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend into develop 2025-11-10 16:16:21 +01:00
Nino
7c29429040 fix(get-main-actions): Return only enabled Actions 2025-11-10 16:15:41 +01:00
Nino Righi
c3e9a03169 Merged PR 2015: fix(crm-data-access, customer-details, reward-shopping-cart): persist selecte...
fix(crm-data-access, customer-details, reward-shopping-cart): persist selected addresses across navigation flows

Implement address selection persistence using CRM tab metadata to ensure
selected shipping addresses and payers are retained throughout the customer
selection flow, particularly when navigating from Kundenkarte to reward cart.

Changes include:
- Create PayerResource and CustomerPayerAddressResource to load selected
  payer from tab metadata with fallback to customer as payer
- Create PayerService to fetch payer data from CRM API with proper error
  handling and abort signal support
- Update BillingAndShippingAddressCardComponent to prefer selected addresses
  from metadata over customer defaults, with computed loading state
- Refactor continue() flow in CustomerDetailsViewMainComponent to load
  selected addresses from metadata before setting in checkout service
- Add adapter logic to convert CRM payer/shipping address types to checkout
  types with proper type casting for incompatible enum types
- Implement fallback chain: metadata selection → component state → customer
  default for both payer and shipping address

This ensures address selections made in the address selection dialogs are
properly preserved and applied when completing the customer selection flow,
fixing the issue where addresses would revert to customer defaults.

Ref: #5411
2025-11-10 15:10:56 +00:00
Lorenz Hilpert
b984a2cac2 Merged PR 2014: fix(open-reward-tasks): filter out pickup-only reward orders
fix(open-reward-tasks): filter out pickup-only reward orders

Exclude reward orders with only pickup items (supplier_id: '16') from open tasks
as these cannot be completed in the reward shop.

Fixes BUG-5444
2025-11-10 13:11:49 +00:00
Lorenz Hilpert
b0afc80a26 Merged PR 2013: 🐛 fix(order-destination): display 'Hugendubel Digital' for download destinat...
🐛 fix(order-destination): display 'Hugendubel Digital' for download destinations

Fixes #5453

- Add handling for Download order type in name() computed signal to return 'Hugendubel Digital'
- Add handling for Download order type in address() computed signal to return undefined
- Update template to conditionally show pipe separator and address only when address exists
- Add isaDeliveryDownload icon for download order type
- Remove unused OrderType import

Related work items: #5453
2025-11-07 16:21:08 +00:00
Lorenz Hilpert
3bc6d47c31 Merged PR 2012: fix(purchase-options): resolve Lesepunkte delivery method change error
fix(purchase-options): resolve Lesepunkte delivery method change error

  The commit includes:
  - Restored ensureCurrencyDefaults import that was accidentally removed
  - Fixed immutability violations in both getAddToShoppingCartDTOForItem and getUpdateShoppingCartItemDTOForItem methods
  - Proper handling of frozen NgRx ComponentStore state objects
  - Resolves bug #5452 where Lesepunkte delivery method changes failed

  The pre-commit hooks ran successfully (ESLint passed with no changes needed). The fix is now ready to be pushed and tested.

Related work items: #5452
2025-11-07 15:56:50 +00:00
Lorenz Hilpert
e05deeb8bc Merged PR 2011: 🐛 fix(checkout): include download orders in destination update flow
🐛 fix(checkout): include download orders in destination update flow

Fixes #5448 - Prämienshop download orders now properly update destination
logistician before order creation. Previously, download orders were excluded
from the destination update step, causing null logistician errors during
order creation in the reward shop.

The fix adds hasDownload to the condition that determines whether to update
destination shipping addresses, ensuring download items (including those
purchased with loyalty points) get their logistician properly assigned.

Related work items: #5448
2025-11-07 15:07:49 +00:00
Nino Righi
11e2aaff8d Merged PR 2010: fix(reward-shopping-cart-item, filter-service): exclude downloads and text in...
fix(reward-shopping-cart-item, filter-service): exclude downloads and text inputs from counts

Hide low stock warning for download items in reward shopping cart, as
downloads don't have physical inventory constraints.

Exclude text/searchbox inputs from selected filter count calculation
to prevent search queries from inflating the filter badge counter.

Remove unused isIconButtonActive computed property in filter menu button.

Ref: #5441
2025-11-07 15:03:41 +00:00
Lorenz Hilpert
731df8414d Merged PR 2009: fix shopping cart - sync issues 2025-11-07 12:18:31 +00:00
Nino Righi
f04e36e710 Merged PR 2008: fix(reward-print, reward-popup, reward-destination): improve reward cart stab...
fix(reward-print, reward-popup, reward-destination): improve reward cart stability and UX

- fix: remove console.log statement from calculate-price-value helper
- fix: add loading/pending state to print button to prevent duplicate prints
- fix: debounce reward selection resource reloading to prevent race conditions
- fix: correct reward cart item destination-info alignment and flex behavior
- fix: support OrderType in OrderDestinationComponent alongside OrderTypeFeature
- fix: use unitPrice instead of total for price calculations in reward items
- refactor: update calculatePriceValue test descriptions for clarity
- fix: fallback to order.orderType when features don't contain orderType

The reward selection popup now properly waits for all resources to reload
before resolving, preventing timing issues with cart synchronization.
Print button shows pending state during print operations.
Destination info components now handle both legacy OrderType and new
OrderTypeFeature enums for better compatibility.

Ref: #5442, #5445
2025-11-06 16:32:10 +00:00
Lorenz Hilpert
af7bad03f5 💄 style: reformat crm-customer.service for improved readability
Apply consistent code formatting with multi-line function parameters and object properties throughout the CRM customer service. No functional changes.
2025-11-06 17:30:18 +01:00
Lorenz Hilpert
8e4d4ff804 🔄 chore: sync swagger API clients with backend updates
- Regenerated all Swagger API clients (availability, checkout, crm, isa, print, wws)
- Updated CRM loyalty card API endpoints (removed interests, added booking/bon management)
- Temporarily disabled interests form block functionality due to API changes
- Removed deprecated models (check-loyalty-card-result, loyalty-card-status, entity-key-value)
- Added new loyalty booking and bon management models and services
2025-11-06 17:03:37 +01:00
Lorenz Hilpert
89b3d9aa60 Merged PR 2000: open tasks
Related work items: #5309
2025-11-06 10:01:41 +00:00
Lorenz Hilpert
1d4c900d3a 🔧 chore: configure junit and cobertura test reporting
- Add junit reporter to vitest configs for CI/CD integration
- Enable cobertura coverage reports for test analytics
- Add @ts-expect-error comment for complex vitest reporter types
- Remove duplicate test target from reward-selection-dialog project.json
2025-11-06 10:46:38 +01:00
Nino Righi
a6f0aaf1cc Merged PR 2007: fix(filter-service, number-range-filter-input): resolve NumberRange state man...
fix(filter-service, number-range-filter-input): resolve NumberRange state management and reference issues

**Root Cause:**
Filter service was experiencing reference sharing between current state and
committed state due to shallow copying in commit(), causing filters to
incorrectly appear as "changed" when mixing NumberRange with other filter
types like Checkbox.

**Changes Made:**

1. **State Management (filter.service.ts):**
   - Use structuredClone() in commit() for deep copies to prevent reference sharing
   - Update clear() to preserve structural properties (options array references)
   - Refactor resetInput() to selectively copy only mutable properties while
     preserving structural ones for isEqual() comparisons
   - Simplify selectedFilterCount to use isDefaultFilterInput() consistently

2. **Default Values (number-range-filter-input.mapping.ts):**
   - Parse minValue/maxValue from config (e.g., "1-" → 1) as defaults
   - Use parsed defaults as initial min/max when no explicit value provided

**Impact:**
- NumberRange filters correctly display default values in UI
- Filters no longer incorrectly show as "changed" after multiple commits
- "Standardeinstellungen" works correctly when mixing NumberRange with other types
- selectedFilterCount accurately reflects changed filters including NumberRange

Ref: #5402
2025-11-05 20:17:52 +00:00