Files
ISA-Frontend/libs/crm/data-access/src/lib/schemas/add-booking.schema.ts
Nino 1f2eff8615 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-17 18:31:48 +01:00

19 lines
558 B
TypeScript

import { z } from 'zod';
export const AddBookingSchema = z.object({
cardCode: z.string().describe('Unique card code identifier'),
booking: z
.object({
points: z.number().describe('Booking points'),
reason: z.string().optional().describe('Booking Reason'),
storeId: z
.string()
.optional()
.describe('Booking store (convercus store id)'),
})
.describe('Booking details'),
});
export type AddBooking = z.infer<typeof AddBookingSchema>;
export type AddBookingInput = z.input<typeof AddBookingSchema>;