feat: lang
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'dart:math' show cos, sin;
|
||||
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../domain/order/order.dart';
|
||||
import '../../../components/appbar/appbar.dart';
|
||||
@@ -22,33 +23,33 @@ class OrderDetailPage extends StatelessWidget {
|
||||
expandedHeight: 120,
|
||||
pinned: true,
|
||||
backgroundColor: AppColor.primary,
|
||||
flexibleSpace: const CustomAppBar(title: "Detail Pesanan"),
|
||||
flexibleSpace: CustomAppBar(title: context.lang.order_details),
|
||||
elevation: 0,
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Column(
|
||||
children: [
|
||||
// Order Status Card
|
||||
_buildOrderStatusCard(),
|
||||
_buildOrderStatusCard(context),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Table Visual Card (for dine-in)
|
||||
if (_isDineIn()) _buildTableVisualCard(),
|
||||
if (_isDineIn()) _buildTableVisualCard(context),
|
||||
|
||||
// Order Info Card
|
||||
_buildOrderInfoCard(),
|
||||
_buildOrderInfoCard(context),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Order Items Section
|
||||
_buildOrderItemsSection(),
|
||||
_buildOrderItemsSection(context),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Payment Summary Card
|
||||
_buildPaymentSummaryCard(),
|
||||
_buildPaymentSummaryCard(context),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Payment Methods Section
|
||||
_buildPaymentMethodsSection(),
|
||||
_buildPaymentMethodsSection(context),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
@@ -58,7 +59,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderStatusCard() {
|
||||
Widget _buildOrderStatusCard(BuildContext context) {
|
||||
Color statusColor = _getStatusColor(order.status);
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(16),
|
||||
@@ -123,7 +124,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Order Number',
|
||||
context.lang.order_number,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -157,7 +158,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Status Pesanan',
|
||||
context.lang.order_status,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -197,7 +198,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'Total Amount',
|
||||
context.lang.total_amount,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -222,7 +223,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTableVisualCard() {
|
||||
Widget _buildTableVisualCard(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
height: 220, // Increased height
|
||||
@@ -284,14 +285,14 @@ class OrderDetailPage extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Makan di Tempat',
|
||||
context.lang.dine_in,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.white.withOpacity(0.9),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Dine In Experience',
|
||||
context.lang.dine_in_experience,
|
||||
style: AppStyle.lg.copyWith(
|
||||
color: AppColor.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -347,7 +348,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'MEJA',
|
||||
context.lang.table,
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.primary.withOpacity(
|
||||
0.7,
|
||||
@@ -417,7 +418,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'${order.orderItems.length} Items',
|
||||
'${order.orderItems.length} ${context.lang.items}',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -470,7 +471,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderInfoCard() {
|
||||
Widget _buildOrderInfoCard(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -517,7 +518,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Text(
|
||||
'Informasi Pesanan',
|
||||
context.lang.order_information,
|
||||
style: AppStyle.xl.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.primary,
|
||||
@@ -527,24 +528,28 @@ class OrderDetailPage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
if (_shouldShowTableNumber())
|
||||
_buildInfoRow(Icons.table_restaurant, 'Meja', order.tableNumber),
|
||||
_buildInfoRow(
|
||||
Icons.table_restaurant,
|
||||
context.lang.table,
|
||||
order.tableNumber,
|
||||
),
|
||||
_buildInfoRow(
|
||||
Icons.delivery_dining,
|
||||
'Tipe Pesanan',
|
||||
context.lang.order_type,
|
||||
order.orderType,
|
||||
),
|
||||
_buildInfoRow(
|
||||
Icons.payment,
|
||||
'Status Pembayaran',
|
||||
context.lang.payment_status,
|
||||
order.paymentStatus,
|
||||
),
|
||||
_buildInfoRow(
|
||||
Icons.access_time,
|
||||
'Dibuat',
|
||||
context.lang.created,
|
||||
_formatDateTime(order.createdAt),
|
||||
),
|
||||
if (order.notes.isNotEmpty)
|
||||
_buildInfoRow(Icons.note, 'Catatan', order.notes),
|
||||
_buildInfoRow(Icons.note, context.lang.note, order.notes),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -590,7 +595,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderItemsSection() {
|
||||
Widget _buildOrderItemsSection(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -612,7 +617,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Item Pesanan',
|
||||
context.lang.order_item,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
@@ -629,7 +634,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${order.orderItems.length} Item',
|
||||
'${order.orderItems.length} ${context.lang.item}',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -647,7 +652,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
separatorBuilder: (context, index) => const Divider(height: 24),
|
||||
itemBuilder: (context, index) {
|
||||
final item = order.orderItems[index];
|
||||
return _buildOrderItemCard(item);
|
||||
return _buildOrderItemCard(context, item);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -655,9 +660,9 @@ class OrderDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderItemCard(OrderItem item) {
|
||||
Widget _buildOrderItemCard(BuildContext context, OrderItem item) {
|
||||
// Assume we add status to OrderItem model or determine from order status
|
||||
String itemStatus = _getItemStatus(item);
|
||||
String itemStatus = _getItemStatus(context, item);
|
||||
Color itemStatusColor = _getItemStatusColor(itemStatus);
|
||||
|
||||
return Container(
|
||||
@@ -786,7 +791,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
'Diskon: -Rp ${_formatCurrency(item.discountAmount)}',
|
||||
'${context.lang.discount}: -Rp ${_formatCurrency(item.discountAmount)}',
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: AppColor.error,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -811,7 +816,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Total Item',
|
||||
context.lang.total_item,
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.textSecondary,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -845,7 +850,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPaymentSummaryCard() {
|
||||
Widget _buildPaymentSummaryCard(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -866,26 +871,38 @@ class OrderDetailPage extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Ringkasan Pembayaran',
|
||||
context.lang.payment_summary,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildSummaryRow('Subtotal', order.subtotal),
|
||||
_buildSummaryRow(context.lang.subtotal, order.subtotal),
|
||||
if (order.discountAmount > 0)
|
||||
_buildSummaryRow(
|
||||
'Diskon',
|
||||
context.lang.discount,
|
||||
-order.discountAmount,
|
||||
isDiscount: true,
|
||||
),
|
||||
_buildSummaryRow('Pajak', order.taxAmount),
|
||||
_buildSummaryRow(context.lang.tax, order.taxAmount),
|
||||
const Divider(height: 24),
|
||||
_buildSummaryRow('Total', order.totalAmount, isTotal: true),
|
||||
_buildSummaryRow('Dibayar', order.totalPaid, isSuccess: true),
|
||||
_buildSummaryRow(
|
||||
context.lang.total,
|
||||
order.totalAmount,
|
||||
isTotal: true,
|
||||
),
|
||||
_buildSummaryRow(
|
||||
context.lang.paid,
|
||||
order.totalPaid,
|
||||
isSuccess: true,
|
||||
),
|
||||
if (order.remainingAmount > 0)
|
||||
_buildSummaryRow('Sisa', order.remainingAmount, isError: true),
|
||||
_buildSummaryRow(
|
||||
context.lang.remaining,
|
||||
order.remainingAmount,
|
||||
isError: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -930,7 +947,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPaymentMethodsSection() {
|
||||
Widget _buildPaymentMethodsSection(BuildContext context) {
|
||||
if (order.payments.isEmpty) return const SizedBox();
|
||||
|
||||
return Container(
|
||||
@@ -952,7 +969,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 20, 20, 0),
|
||||
child: Text(
|
||||
'Metode Pembayaran',
|
||||
context.lang.payment_method,
|
||||
style: AppStyle.lg.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.textPrimary,
|
||||
@@ -1159,7 +1176,7 @@ class OrderDetailPage extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
String _getItemStatus(OrderItem item) {
|
||||
String _getItemStatus(BuildContext context, OrderItem item) {
|
||||
// Logic untuk menentukan status item berdasarkan:
|
||||
// 1. Status order secara keseluruhan
|
||||
// 2. Jika ada field status di OrderItem model
|
||||
@@ -1167,26 +1184,24 @@ class OrderDetailPage extends StatelessWidget {
|
||||
|
||||
switch (order.status.toLowerCase()) {
|
||||
case 'completed':
|
||||
return 'Selesai';
|
||||
return context.lang.completed;
|
||||
case 'pending':
|
||||
return 'Menunggu';
|
||||
return context.lang.pending;
|
||||
case 'cancelled':
|
||||
return 'Dibatalkan';
|
||||
return context.lang.void_text;
|
||||
default:
|
||||
return 'Menunggu';
|
||||
return context.lang.pending;
|
||||
}
|
||||
}
|
||||
|
||||
Color _getItemStatusColor(String status) {
|
||||
switch (status.toLowerCase()) {
|
||||
case 'selesai':
|
||||
case 'completed':
|
||||
return AppColor.success;
|
||||
case 'diproses':
|
||||
case 'pending':
|
||||
return AppColor.warning;
|
||||
case 'dibatalkan':
|
||||
case 'cancelled':
|
||||
return AppColor.error;
|
||||
case 'siap':
|
||||
return AppColor.info;
|
||||
default:
|
||||
return AppColor.primary;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,13 @@ import 'dart:developer';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
import '../../../../application/order/order_loader/order_loader_bloc.dart';
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../injection.dart';
|
||||
import '../../../components/appbar/appbar.dart';
|
||||
import '../../../components/button/button.dart';
|
||||
import '../../../components/spacer/spacer.dart';
|
||||
import '../../../components/widgets/empty_widget.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
import 'widgets/filter_header_delegate.dart';
|
||||
@@ -224,11 +222,10 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
|
||||
pinned: true,
|
||||
backgroundColor: AppColor.primary,
|
||||
centerTitle: false,
|
||||
flexibleSpace: CustomAppBar(title: 'Order', isBack: false),
|
||||
actions: [
|
||||
ActionIconButton(onTap: () {}, icon: LineIcons.filter),
|
||||
SpaceWidth(8),
|
||||
],
|
||||
flexibleSpace: CustomAppBar(
|
||||
title: context.lang.orders,
|
||||
isBack: false,
|
||||
),
|
||||
),
|
||||
|
||||
// Pinned Filter Section
|
||||
@@ -285,7 +282,7 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'${state.orders.length} ${state.status.toLowerCase()} order${state.orders.length != 1 ? 's' : ''}',
|
||||
'${state.orders.length} ${state.status.toLowerCase()} ${context.lang.orders}',
|
||||
style: TextStyle(
|
||||
color: AppColor.textSecondary,
|
||||
fontSize: 14,
|
||||
@@ -300,9 +297,10 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
|
||||
_buildShimmerList()
|
||||
else if (state.orders.isEmpty)
|
||||
EmptyWidget(
|
||||
title: 'Order',
|
||||
message:
|
||||
'No ${state.status.toLowerCase()} orders found',
|
||||
title: context.lang.order,
|
||||
message: context.lang.no_order_with_status(
|
||||
state.status.toLowerCase(),
|
||||
),
|
||||
)
|
||||
else
|
||||
ListView.builder(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../common/extension/extension.dart';
|
||||
import '../../../../components/field/date_range_picker_field.dart';
|
||||
import 'status_tile.dart';
|
||||
|
||||
@@ -36,7 +37,6 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
double shrinkOffset,
|
||||
bool overlapsContent,
|
||||
) {
|
||||
print('FilterHeaderDelegate build called'); // Debug log
|
||||
return Container(
|
||||
color: backgroundColor,
|
||||
padding: padding,
|
||||
@@ -50,9 +50,6 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
onChanged: (start, end) {
|
||||
print(
|
||||
'onChanged called in FilterHeaderDelegate: $start - $end',
|
||||
); // Debug log
|
||||
onDateChanged(start, end);
|
||||
},
|
||||
),
|
||||
@@ -70,7 +67,11 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
right: index < filterOptions.length - 1 ? 8 : 0,
|
||||
),
|
||||
child: OrderStatusTile(
|
||||
label: option,
|
||||
label: option == "All"
|
||||
? context.lang.all
|
||||
: option == "Completed"
|
||||
? context.lang.completed
|
||||
: context.lang.pending,
|
||||
isSelected: option == selectedFilter,
|
||||
onSelected: (isSelected) {
|
||||
if (isSelected) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../../../common/extension/extension.dart';
|
||||
import '../../../../../common/theme/theme.dart';
|
||||
import '../../../../../domain/order/order.dart';
|
||||
|
||||
@@ -46,19 +47,19 @@ class OrderTile extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header Row
|
||||
_buildHeaderRow(),
|
||||
_buildHeaderRow(context),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Order Info
|
||||
_buildOrderInfo(),
|
||||
_buildOrderInfo(context),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Amount Section
|
||||
_buildAmountSection(),
|
||||
_buildAmountSection(context),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Footer with Actions
|
||||
_buildFooterActions(),
|
||||
_buildFooterActions(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -67,7 +68,7 @@ class OrderTile extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeaderRow() {
|
||||
Widget _buildHeaderRow(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -94,12 +95,12 @@ class OrderTile extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
_buildStatusChip(),
|
||||
_buildStatusChip(context),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusChip() {
|
||||
Widget _buildStatusChip(BuildContext context) {
|
||||
Color statusColor;
|
||||
String statusText;
|
||||
IconData statusIcon;
|
||||
@@ -107,27 +108,34 @@ class OrderTile extends StatelessWidget {
|
||||
// Check isVoid and isRefund first for display
|
||||
if (order.isVoid) {
|
||||
statusColor = AppColor.error;
|
||||
statusText = 'Void';
|
||||
statusText = context.lang.void_text;
|
||||
statusIcon = Icons.block;
|
||||
} else if (order.isRefund) {
|
||||
statusColor = AppColor.info;
|
||||
statusText = 'Refunded';
|
||||
statusText = context.lang.refund;
|
||||
statusIcon = Icons.undo;
|
||||
} else {
|
||||
// Handle status values (only pending and completed)
|
||||
switch (order.status.toLowerCase()) {
|
||||
case 'completed':
|
||||
statusColor = AppColor.success;
|
||||
statusText = context.lang.completed;
|
||||
statusIcon = Icons.check_circle;
|
||||
case 'paid':
|
||||
case 'finished':
|
||||
statusColor = AppColor.success;
|
||||
statusText = 'Completed';
|
||||
statusText = context.lang.completed;
|
||||
statusIcon = Icons.check_circle;
|
||||
break;
|
||||
case 'pending':
|
||||
statusColor = AppColor.warning;
|
||||
statusText = context.lang.pending;
|
||||
statusIcon = Icons.schedule;
|
||||
break;
|
||||
case 'waiting':
|
||||
case 'processing':
|
||||
statusColor = AppColor.warning;
|
||||
statusText = 'Pending';
|
||||
statusText = context.lang.pending;
|
||||
statusIcon = Icons.schedule;
|
||||
break;
|
||||
default:
|
||||
@@ -163,7 +171,7 @@ class OrderTile extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOrderInfo() {
|
||||
Widget _buildOrderInfo(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -177,7 +185,7 @@ class OrderTile extends StatelessWidget {
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
_getOrderInfoText(),
|
||||
_getOrderInfoText(context),
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -198,7 +206,7 @@ class OrderTile extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'${order.orderItems.length} items',
|
||||
'${order.orderItems.length} ${context.lang.items}',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColor.textSecondary,
|
||||
@@ -239,7 +247,7 @@ class OrderTile extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAmountSection() {
|
||||
Widget _buildAmountSection(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -264,8 +272,8 @@ class OrderTile extends StatelessWidget {
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Total Amount',
|
||||
Text(
|
||||
context.lang.total_amount,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColor.textWhite,
|
||||
@@ -274,7 +282,7 @@ class OrderTile extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Rp ${NumberFormat('#,###').format(order.totalAmount)}',
|
||||
order.totalAmount.currencyFormatRp,
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -284,7 +292,7 @@ class OrderTile extends StatelessWidget {
|
||||
if (order.remainingAmount > 0) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Remaining: Rp ${NumberFormat('#,###').format(order.remainingAmount)}',
|
||||
'${context.lang.remaining}: ${order.remainingAmount.currencyFormatRp}',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColor.textWhite,
|
||||
@@ -311,7 +319,7 @@ class OrderTile extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFooterActions() {
|
||||
Widget _buildFooterActions(BuildContext context) {
|
||||
// Don't show anything if order is void or refunded
|
||||
if (order.isVoid || order.isRefund) {
|
||||
return const SizedBox.shrink();
|
||||
@@ -326,7 +334,7 @@ class OrderTile extends StatelessWidget {
|
||||
if (order.payments.isNotEmpty) ...[
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'Payment: ${_getPaymentMethods()}',
|
||||
'${context.lang.payment}: ${_getPaymentMethods()}',
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: AppColor.textLight,
|
||||
@@ -337,59 +345,10 @@ class OrderTile extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (order.status.toLowerCase() == 'completed') ...[
|
||||
_buildActionButton(
|
||||
icon: Icons.print,
|
||||
label: 'Print',
|
||||
onPressed: onPrint,
|
||||
color: AppColor.info,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildActionButton(
|
||||
icon: Icons.undo,
|
||||
label: 'Refund',
|
||||
onPressed: onRefund,
|
||||
color: AppColor.warning,
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionButton({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required VoidCallback? onPressed,
|
||||
required Color color,
|
||||
}) {
|
||||
return Material(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: InkWell(
|
||||
onTap: onPressed,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, size: 16, color: color),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
IconData _getOrderInfoIcon() {
|
||||
switch (order.orderType.toLowerCase()) {
|
||||
case 'dine in':
|
||||
@@ -406,11 +365,11 @@ class OrderTile extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
String _getOrderInfoText() {
|
||||
String _getOrderInfoText(BuildContext context) {
|
||||
switch (order.orderType.toLowerCase()) {
|
||||
case 'dine in':
|
||||
case 'dine_in':
|
||||
return 'Table ${order.tableNumber.isNotEmpty ? order.tableNumber : 'N/A'}';
|
||||
return '${context.lang.table} ${order.tableNumber.isNotEmpty ? order.tableNumber : 'N/A'}';
|
||||
case 'takeaway':
|
||||
case 'take_away':
|
||||
case 'pickup':
|
||||
@@ -419,8 +378,8 @@ class OrderTile extends StatelessWidget {
|
||||
return 'Delivery Order';
|
||||
default:
|
||||
return order.tableNumber.isNotEmpty
|
||||
? 'Table ${order.tableNumber}'
|
||||
: 'Order ${order.orderNumber}';
|
||||
? '${context.lang.table} ${order.tableNumber}'
|
||||
: context.lang.order;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user