create order

This commit is contained in:
Phuoc Nguyen
2025-11-21 16:50:43 +07:00
parent f2f95849d4
commit 4913a4e04b
31 changed files with 1696 additions and 187 deletions

View File

@@ -0,0 +1,31 @@
/// Order Status Entity
///
/// Represents an order status option from the API.
library;
import 'package:equatable/equatable.dart';
/// Order Status Entity
class OrderStatus extends Equatable {
/// Status value (e.g., "Pending approval", "Processing", "Completed")
final String status;
/// Vietnamese label (e.g., "Chờ phê duyệt", "Đang xử lý", "Hoàn thành")
final String label;
/// Color indicator (e.g., "Warning", "Success", "Danger")
final String color;
/// Display order index
final int index;
const OrderStatus({
required this.status,
required this.label,
required this.color,
required this.index,
});
@override
List<Object?> get props => [status, label, color, index];
}

View File

@@ -0,0 +1,23 @@
/// Payment Term Entity
///
/// Represents a payment term template option from the API.
library;
import 'package:equatable/equatable.dart';
/// Payment Term Entity
class PaymentTerm extends Equatable {
/// Payment term name (e.g., "Thanh toán hoàn toàn", "Thanh toán trả trước")
final String name;
/// Custom description (e.g., "Thanh toán ngay được chiết khấu 2%")
final String customDescription;
const PaymentTerm({
required this.name,
required this.customDescription,
});
@override
List<Object?> get props => [name, customDescription];
}

View File

@@ -0,0 +1,26 @@
/// Order Repository Interface
///
/// Defines the contract for order-related data operations.
library;
import 'package:worker/features/orders/domain/entities/order_status.dart';
import 'package:worker/features/orders/domain/entities/payment_term.dart';
/// Order Repository Interface
abstract class OrderRepository {
/// Get list of available order statuses
Future<List<OrderStatus>> getOrderStatusList();
/// Get list of available payment terms
Future<List<PaymentTerm>> getPaymentTermsList();
/// Create new order
Future<Map<String, dynamic>> createOrder({
required List<Map<String, dynamic>> items,
required Map<String, dynamic> deliveryAddress,
required String paymentMethod,
bool needsInvoice = false,
bool needsNegotiation = false,
String? notes,
});
}