payfrit-app/lib/models/order_history.dart
John Mizerek 2491c961e0 Add address management and user account features
- Add delivery address list, add, edit, delete, set default functionality
- Add order history screen
- Add profile settings screen
- Add account screen with avatar upload
- Update restaurant select gradient direction
- Add states API endpoint for address forms
- Fix table names (tt_States)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 20:22:37 -08:00

48 lines
1.6 KiB
Dart

class OrderHistoryItem {
final int orderId;
final String orderUuid;
final int businessId;
final String businessName;
final double total;
final int statusId;
final String statusName;
final int orderTypeId;
final String typeName;
final int itemCount;
final DateTime createdAt;
final DateTime? completedAt;
const OrderHistoryItem({
required this.orderId,
required this.orderUuid,
required this.businessId,
required this.businessName,
required this.total,
required this.statusId,
required this.statusName,
required this.orderTypeId,
required this.typeName,
required this.itemCount,
required this.createdAt,
this.completedAt,
});
factory OrderHistoryItem.fromJson(Map<String, dynamic> json) {
return OrderHistoryItem(
orderId: (json["OrderID"] as num).toInt(),
orderUuid: json["OrderUUID"] as String? ?? "",
businessId: (json["BusinessID"] as num).toInt(),
businessName: json["BusinessName"] as String? ?? "Unknown",
total: (json["OrderTotal"] as num?)?.toDouble() ?? 0.0,
statusId: (json["OrderStatusID"] as num).toInt(),
statusName: json["StatusName"] as String? ?? "Unknown",
orderTypeId: (json["OrderTypeID"] as num?)?.toInt() ?? 0,
typeName: json["TypeName"] as String? ?? "Unknown",
itemCount: (json["ItemCount"] as num?)?.toInt() ?? 0,
createdAt: DateTime.tryParse(json["CreatedAt"] as String? ?? "") ?? DateTime.now(),
completedAt: json["CompletedAt"] != null && (json["CompletedAt"] as String).isNotEmpty
? DateTime.tryParse(json["CompletedAt"] as String)
: null,
);
}
}