order success

This commit is contained in:
Phuoc Nguyen
2025-11-24 17:28:17 +07:00
parent 1851d60038
commit c3b5653420
9 changed files with 55 additions and 34 deletions

View File

@@ -92,6 +92,8 @@ class OrderRemoteDataSource {
/// "customer_address": "...",
/// "description": "...",
/// "payment_terms": "...",
/// "ignore_pricing_rule": true,
/// "contract_request": true,
/// "items": [{"item_id": "...", "qty_entered": 0, "primary_qty": 0, "price_entered": 0}]
/// }
/// Returns: { "message": { "name": "SAL-ORD-2025-00001", ... } }
@@ -100,7 +102,8 @@ class OrderRemoteDataSource {
required Map<String, dynamic> deliveryAddress,
required String paymentMethod,
bool needsInvoice = false,
bool needsNegotiation = false,
bool ignorePricingRule = false,
bool contractRequest = false,
String? notes,
}) async {
try {
@@ -126,6 +129,8 @@ class OrderRemoteDataSource {
'customer_address': deliveryAddress['name'] ?? '',
'description': notes ?? 'Order from mobile app',
'payment_terms': paymentMethod,
'ignore_pricing_rule': ignorePricingRule,
'contract_request': contractRequest,
'items': formattedItems,
};

View File

@@ -98,7 +98,8 @@ class OrderRepositoryImpl implements OrderRepository {
required Map<String, dynamic> deliveryAddress,
required String paymentMethod,
bool needsInvoice = false,
bool needsNegotiation = false,
bool ignorePricingRule = false,
bool contractRequest = false,
String? notes,
}) async {
try {
@@ -107,7 +108,8 @@ class OrderRepositoryImpl implements OrderRepository {
deliveryAddress: deliveryAddress,
paymentMethod: paymentMethod,
needsInvoice: needsInvoice,
needsNegotiation: needsNegotiation,
ignorePricingRule: ignorePricingRule,
contractRequest: contractRequest,
notes: notes,
);
} catch (e) {

View File

@@ -31,7 +31,8 @@ abstract class OrderRepository {
required Map<String, dynamic> deliveryAddress,
required String paymentMethod,
bool needsInvoice = false,
bool needsNegotiation = false,
bool ignorePricingRule = false,
bool contractRequest = false,
String? notes,
});

View File

@@ -183,7 +183,7 @@ class OrderSuccessPage extends StatelessWidget {
// Navigate to order details page
context.pushReplacementNamed(
RouteNames.orderDetail,
pathParameters: {'orderId': orderNumber},
pathParameters: {'id': orderNumber},
);
},
icon: const FaIcon(FontAwesomeIcons.eye, size: 18),

View File

@@ -31,7 +31,8 @@ Future<Map<String, dynamic>> createOrder(
required Map<String, dynamic> deliveryAddress,
required String paymentMethod,
bool needsInvoice = false,
bool needsNegotiation = false,
bool ignorePricingRule = false,
bool contractRequest = false,
String? notes,
}) async {
final repository = await ref.watch(orderRepositoryProvider.future);
@@ -40,7 +41,8 @@ Future<Map<String, dynamic>> createOrder(
deliveryAddress: deliveryAddress,
paymentMethod: paymentMethod,
needsInvoice: needsInvoice,
needsNegotiation: needsNegotiation,
ignorePricingRule: ignorePricingRule,
contractRequest: contractRequest,
notes: notes,
);
}

View File

@@ -83,7 +83,8 @@ final class CreateOrderProvider
Map<String, dynamic> deliveryAddress,
String paymentMethod,
bool needsInvoice,
bool needsNegotiation,
bool ignorePricingRule,
bool contractRequest,
String? notes,
})
super.argument,
@@ -120,7 +121,8 @@ final class CreateOrderProvider
Map<String, dynamic> deliveryAddress,
String paymentMethod,
bool needsInvoice,
bool needsNegotiation,
bool ignorePricingRule,
bool contractRequest,
String? notes,
});
return createOrder(
@@ -129,7 +131,8 @@ final class CreateOrderProvider
deliveryAddress: argument.deliveryAddress,
paymentMethod: argument.paymentMethod,
needsInvoice: argument.needsInvoice,
needsNegotiation: argument.needsNegotiation,
ignorePricingRule: argument.ignorePricingRule,
contractRequest: argument.contractRequest,
notes: argument.notes,
);
}
@@ -145,7 +148,7 @@ final class CreateOrderProvider
}
}
String _$createOrderHash() => r'2d13526815e19a2bbef2f2974dad991d8ffcb594';
String _$createOrderHash() => r'622a1d98d53a6696a302cde85842d449a8164fe7';
/// Create Order Provider
///
@@ -160,7 +163,8 @@ final class CreateOrderFamily extends $Family
Map<String, dynamic> deliveryAddress,
String paymentMethod,
bool needsInvoice,
bool needsNegotiation,
bool ignorePricingRule,
bool contractRequest,
String? notes,
})
> {
@@ -182,7 +186,8 @@ final class CreateOrderFamily extends $Family
required Map<String, dynamic> deliveryAddress,
required String paymentMethod,
bool needsInvoice = false,
bool needsNegotiation = false,
bool ignorePricingRule = false,
bool contractRequest = false,
String? notes,
}) => CreateOrderProvider._(
argument: (
@@ -190,7 +195,8 @@ final class CreateOrderFamily extends $Family
deliveryAddress: deliveryAddress,
paymentMethod: paymentMethod,
needsInvoice: needsInvoice,
needsNegotiation: needsNegotiation,
ignorePricingRule: ignorePricingRule,
contractRequest: contractRequest,
notes: notes,
),
from: this,