order detail
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:worker/features/cart/presentation/pages/cart_page.dart';
|
|||||||
import 'package:worker/features/favorites/presentation/pages/favorites_page.dart';
|
import 'package:worker/features/favorites/presentation/pages/favorites_page.dart';
|
||||||
import 'package:worker/features/loyalty/presentation/pages/rewards_page.dart';
|
import 'package:worker/features/loyalty/presentation/pages/rewards_page.dart';
|
||||||
import 'package:worker/features/main/presentation/pages/main_scaffold.dart';
|
import 'package:worker/features/main/presentation/pages/main_scaffold.dart';
|
||||||
|
import 'package:worker/features/orders/presentation/pages/order_detail_page.dart';
|
||||||
import 'package:worker/features/orders/presentation/pages/orders_page.dart';
|
import 'package:worker/features/orders/presentation/pages/orders_page.dart';
|
||||||
import 'package:worker/features/orders/presentation/pages/payment_detail_page.dart';
|
import 'package:worker/features/orders/presentation/pages/payment_detail_page.dart';
|
||||||
import 'package:worker/features/orders/presentation/pages/payments_page.dart';
|
import 'package:worker/features/orders/presentation/pages/payments_page.dart';
|
||||||
@@ -119,6 +120,19 @@ class AppRouter {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Order Detail Route
|
||||||
|
GoRoute(
|
||||||
|
path: RouteNames.orderDetail,
|
||||||
|
name: RouteNames.orderDetail,
|
||||||
|
pageBuilder: (context, state) {
|
||||||
|
final orderId = state.pathParameters['id'];
|
||||||
|
return MaterialPage(
|
||||||
|
key: state.pageKey,
|
||||||
|
child: OrderDetailPage(orderId: orderId ?? ''),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
// Payments Route
|
// Payments Route
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RouteNames.payments,
|
path: RouteNames.payments,
|
||||||
|
|||||||
1057
lib/features/orders/presentation/pages/order_detail_page.dart
Normal file
1057
lib/features/orders/presentation/pages/order_detail_page.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -107,15 +107,7 @@ class _OrdersPageState extends ConsumerState<OrdersPage> {
|
|||||||
return OrderCard(
|
return OrderCard(
|
||||||
order: order,
|
order: order,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// TODO: Navigate to order detail page
|
context.push('/orders/${order.orderId}');
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: Text(
|
|
||||||
'Order ${order.orderNumber} tapped',
|
|
||||||
),
|
|
||||||
duration: const Duration(seconds: 1),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -45,74 +45,64 @@ class OrderCard extends StatelessWidget {
|
|||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Container(
|
child: Padding(
|
||||||
decoration: BoxDecoration(
|
padding: const EdgeInsets.all(16),
|
||||||
border: Border(
|
child: Column(
|
||||||
left: BorderSide(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
color: _getStatusColor(order.status),
|
children: [
|
||||||
width: 4,
|
// Order number and amount row
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Order number
|
||||||
|
Text(
|
||||||
|
'#${order.orderNumber}',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: AppColors.grey900,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Amount
|
||||||
|
Text(
|
||||||
|
currencyFormatter.format(order.finalAmount),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: AppColors.primaryBlue,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
// Order number and amount row
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
// Order number
|
|
||||||
Text(
|
|
||||||
'#${order.orderNumber}',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: AppColors.grey900,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Amount
|
const SizedBox(height: 12),
|
||||||
Text(
|
|
||||||
currencyFormatter.format(order.finalAmount),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: AppColors.primaryBlue,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 12),
|
// Order details
|
||||||
|
_buildDetailRow(
|
||||||
|
'Ngày đặt:',
|
||||||
|
_formatDate(order.createdAt),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
|
||||||
// Order details
|
_buildDetailRow(
|
||||||
_buildDetailRow(
|
'Ngày giao:',
|
||||||
'Ngày đặt:',
|
order.expectedDeliveryDate != null
|
||||||
_formatDate(order.createdAt),
|
? _formatDate(order.expectedDeliveryDate!)
|
||||||
),
|
: 'Chưa xác định',
|
||||||
const SizedBox(height: 6),
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
|
||||||
_buildDetailRow(
|
_buildDetailRow(
|
||||||
'Ngày giao:',
|
'Địa chỉ:',
|
||||||
order.expectedDeliveryDate != null
|
_getShortAddress(),
|
||||||
? _formatDate(order.expectedDeliveryDate!)
|
),
|
||||||
: 'Chưa xác định',
|
const SizedBox(height: 12),
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
|
|
||||||
_buildDetailRow(
|
// Status badge
|
||||||
'Địa chỉ:',
|
_buildStatusBadge(),
|
||||||
_getShortAddress(),
|
],
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
|
|
||||||
// Status badge
|
|
||||||
_buildStatusBadge(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user