feat: add support for individual consumable items in service items

- Introduced `consumables` field in `ServiceItem` to allow multiple individual items alongside inventory packages.
- Created `ServiceItemConsumable` entity to manage individual consumable items linked to a service.
- Updated `ServiceItemController` to handle CRUD operations for consumables.
- Enhanced `ServiceDetailPage` and `ServiceItemFormModal` to display and manage consumables.
- Added tests to ensure functionality for adding, updating, and validating consumables.
- Updated API documentation to reflect changes in service item structure and consumables.
This commit is contained in:
hamed
2026-07-18 12:34:42 +03:30
parent c4a661b542
commit c13cc57c48
11 changed files with 530 additions and 40 deletions
+12
View File
@@ -510,6 +510,16 @@ export interface ServiceSection {
items_count?: number;
}
/** یک قلم کالای تکی روی سرویس (خروجی ServiceItemConsumable::toArray) */
export interface ServiceConsumable {
item_uuid: string;
name: string;
unit: string;
price: number; // Rial
stock: number;
amount: number;
}
export interface ServiceItem {
uuid: string;
name: string;
@@ -519,6 +529,8 @@ export interface ServiceItem {
/** پکیج کالای مصرفی متصل به این خدمت (اختیاری) */
inventory_package_uuid?: string | null;
inventory_package_title?: string | null;
/** اقلام کالای تکی — مستقل از پکیج و قابل استفاده هم‌زمان با آن */
consumables?: ServiceConsumable[];
created_at?: number;
updated_at?: number;
/** primary staff (first member) — kept for backward compatibility */