feat(discount): admin Discount Management tab + uuid-based rule targets
Switch rule target references from int ids to uuids (frontend-friendly; the engine compares uuids directly) via a migration. Add a Discount Management tab to the subscription page with a full CRUD UI (DiscountTab): table + modal form with per-type dynamic target fields (tenant tag / service cascade / amount / visit count / specific patient / occasion + validity window), priority and combinable/active toggles. Verified TSC + build. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -124,6 +124,46 @@ export interface AppointmentEvent {
|
||||
created_at: number;
|
||||
}
|
||||
|
||||
export type DiscountRuleType =
|
||||
| 'patient_tag'
|
||||
| 'invoice_amount'
|
||||
| 'specific_patient'
|
||||
| 'occasion'
|
||||
| 'service'
|
||||
| 'visit_count';
|
||||
|
||||
export interface DiscountRule {
|
||||
uuid: string;
|
||||
name: string;
|
||||
type: DiscountRuleType;
|
||||
discount_type: 'percent' | 'fixed';
|
||||
value: number;
|
||||
priority: number;
|
||||
combinable: boolean;
|
||||
active: boolean;
|
||||
valid_from: number | null;
|
||||
valid_to: number | null;
|
||||
target_tag_uuid: string | null;
|
||||
target_record_uuid: string | null;
|
||||
target_service_item_uuid: string | null;
|
||||
min_amount_rials: number | null;
|
||||
min_visit_count: number | null;
|
||||
occasion_kind: string | null;
|
||||
created_at: number;
|
||||
updated_at: number;
|
||||
}
|
||||
|
||||
export interface DiscountSuggestion {
|
||||
rule_uuid: string;
|
||||
rule_name: string;
|
||||
type: DiscountRuleType;
|
||||
discount_type: 'percent' | 'fixed';
|
||||
value: number;
|
||||
discount_rials: number;
|
||||
combinable: boolean;
|
||||
priority: number;
|
||||
}
|
||||
|
||||
export type PaymentStatus =
|
||||
| "pending"
|
||||
| "success"
|
||||
|
||||
Reference in New Issue
Block a user