This commit is contained in:
Phuoc Nguyen
2025-12-11 16:55:25 +07:00
parent fc6a4f038e
commit 4546e7d8e8
15 changed files with 91 additions and 106 deletions

View File

@@ -109,6 +109,15 @@ extension StringExtensions on String {
if (cleaned.length < 10) return this; if (cleaned.length < 10) return this;
return '${cleaned.substring(0, 4)} ${cleaned.substring(4, 7)} ***'; return '${cleaned.substring(0, 4)} ${cleaned.substring(4, 7)} ***';
} }
/// Remove leading "#" from string (e.g., "#SO-001" -> "SO-001")
/// Useful for backend IDs that start with "#"
String get withoutHash {
if (startsWith('#')) {
return substring(1);
}
return this;
}
} }
// ============================================================================ // ============================================================================

View File

@@ -50,7 +50,7 @@ class _CartPageState extends ConsumerState<CartPage> {
_hasLoggedViewCart = true; _hasLoggedViewCart = true;
AnalyticsService.logViewCart( AnalyticsService.logViewCart(
cartValue: cartState.totalPrice, cartValue: cartState.selectedTotal,
items: cartState.items.map((item) => AnalyticsEventItem( items: cartState.items.map((item) => AnalyticsEventItem(
itemId: item.product.productId, itemId: item.product.productId,
itemName: item.product.name, itemName: item.product.name,

View File

@@ -198,7 +198,7 @@ class _HomePageState extends ConsumerState<HomePage> {
actions: [ actions: [
QuickAction( QuickAction(
icon: FontAwesomeIcons.circlePlus, icon: FontAwesomeIcons.circlePlus,
label: 'Ghi nhận điểm', label: 'Tham gia sự kiện',
onTap: () => context.push(RouteNames.pointsRecords), onTap: () => context.push(RouteNames.pointsRecords),
), ),
QuickAction( QuickAction(
@@ -216,7 +216,7 @@ class _HomePageState extends ConsumerState<HomePage> {
// Sample Houses & News Section // Sample Houses & News Section
QuickActionSection( QuickActionSection(
title: 'Nhà mẫu, dự án & tin tức', title: 'Nhà mẫu & Dự án',
actions: [ actions: [
QuickAction( QuickAction(
icon: FontAwesomeIcons.houseCircleCheck, icon: FontAwesomeIcons.houseCircleCheck,

View File

@@ -169,7 +169,7 @@ class InvoiceDetailPage extends ConsumerWidget {
// Invoice Number // Invoice Number
Text( Text(
'#${invoice.name}', invoice.name,
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@@ -192,7 +192,7 @@ class InvoiceDetailPage extends ConsumerWidget {
_MetaItem(label: 'Ngày xuất:', value: invoice.formattedDate), _MetaItem(label: 'Ngày xuất:', value: invoice.formattedDate),
if (invoice.orderId != null) ...[ if (invoice.orderId != null) ...[
const SizedBox(width: 32), const SizedBox(width: 32),
_MetaItem(label: 'Đơn hàng:', value: '#${invoice.orderId}'), _MetaItem(label: 'Đơn hàng:', value: '${invoice.orderId}'),
], ],
], ],
), ),

View File

@@ -209,7 +209,7 @@ class _InvoiceCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'#${invoice.name}', invoice.name,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@@ -252,7 +252,7 @@ class _InvoiceCard extends StatelessWidget {
if (invoice.orderId != null) if (invoice.orderId != null)
_DetailRow( _DetailRow(
label: 'Đơn hàng:', label: 'Đơn hàng:',
value: '#${invoice.orderId}', value: '${invoice.orderId}',
), ),
_DetailRow( _DetailRow(
label: 'Tổng tiền:', label: 'Tổng tiền:',

View File

@@ -402,7 +402,7 @@ class PointsHistoryPage extends ConsumerWidget {
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
'Mã tham chiếu: #${entry.entryId}', 'Mã tham chiếu: ${entry.entryId}',
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: colorScheme.onSurfaceVariant, color: colorScheme.onSurfaceVariant,

View File

@@ -295,7 +295,7 @@ class PointsRecordsPage extends ConsumerWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
'#${record.recordId}', record.recordId,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,

View File

@@ -27,6 +27,8 @@ class NotificationsPage extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final colorScheme = Theme.of(context).colorScheme;
// Use Flutter hooks for local state management // Use Flutter hooks for local state management
final selectedCategory = useState<String>('general'); final selectedCategory = useState<String>('general');
final notificationsAsync = ref.watch( final notificationsAsync = ref.watch(
@@ -34,59 +36,38 @@ class NotificationsPage extends HookConsumerWidget {
); );
return Scaffold( return Scaffold(
backgroundColor: const Color(0xFFF4F6F8), backgroundColor: colorScheme.surfaceContainerLowest,
body: SafeArea( appBar: AppBar(
child: Column( title: Text(
children: [ 'Thông báo',
// Header style: TextStyle(color: colorScheme.onSurface),
_buildHeader(),
// Tabs
_buildTabs(context, selectedCategory),
// Notifications List
Expanded(
child: notificationsAsync.when(
data: (notifications) => _buildNotificationsList(
context,
ref,
notifications,
selectedCategory,
),
loading: () => const CustomLoadingIndicator(),
error: (error, stack) =>
_buildErrorState(ref, selectedCategory),
),
),
],
), ),
elevation: AppBarSpecs.elevation,
backgroundColor: colorScheme.surface,
foregroundColor: colorScheme.onSurface,
centerTitle: false,
), ),
); body: Column(
} children: [
// Tabs
_buildTabs(context, selectedCategory),
/// Build header // Notifications List
Widget _buildHeader() { Expanded(
return Container( child: notificationsAsync.when(
width: double.infinity, data: (notifications) => _buildNotificationsList(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), context,
decoration: BoxDecoration( ref,
color: Colors.white, notifications,
boxShadow: [ selectedCategory,
BoxShadow( ),
color: Colors.black.withValues(alpha: 0.05), loading: () => const CustomLoadingIndicator(),
blurRadius: 8, error: (error, stack) =>
offset: const Offset(0, 2), _buildErrorState(ref, selectedCategory),
),
), ),
], ],
), ),
child: const Text(
'Thông báo',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color(0xFF212121),
),
),
); );
} }

View File

@@ -205,7 +205,7 @@ class OrderDetailPage extends ConsumerWidget {
children: [ children: [
// Order Number and Status Badge // Order Number and Status Badge
Text( Text(
'#${order.name}', order.name,
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,

View File

@@ -248,7 +248,7 @@ class PaymentDetailPage extends ConsumerWidget {
Column( Column(
children: [ children: [
Text( Text(
'#$invoiceNumber', '$invoiceNumber',
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,

View File

@@ -227,7 +227,7 @@ class PaymentsPage extends ConsumerWidget {
children: [ children: [
_DetailRow( _DetailRow(
label: 'Mã giao dịch:', label: 'Mã giao dịch:',
value: '#${payment.name}', value: '${payment.name}',
), ),
_DetailRow( _DetailRow(
label: 'Loại giao dịch:', label: 'Loại giao dịch:',
@@ -325,7 +325,7 @@ class _TransactionCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
'#${payment.name}', payment.name,
style: TextStyle( style: TextStyle(
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,

View File

@@ -48,7 +48,7 @@ class OrderCard extends StatelessWidget {
children: [ children: [
// Order number // Order number
Text( Text(
'#${order.name}', '${order.name}',
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,

View File

@@ -222,7 +222,7 @@ class _QuotesPageState extends ConsumerState<QuotesPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
'#${quote.quoteNumber}', '${quote.quoteNumber}',
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,

View File

@@ -230,7 +230,7 @@ class DesignRequestDetailPage extends ConsumerWidget {
children: [ children: [
// Request ID // Request ID
Text( Text(
'#${request.id}', '${request.id}',
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,

View File

@@ -509,40 +509,35 @@ class _RequestCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Header: Code and Status // Header: Code and Status
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, Container(
children: [ padding: const EdgeInsets.symmetric(
Expanded( horizontal: 12,
child: Text( vertical: 6,
'Mã yêu cầu: #${request.id}', ),
style: TextStyle( decoration: BoxDecoration(
fontSize: 16, color: _getStatusBackgroundColor(),
fontWeight: FontWeight.w700, borderRadius: BorderRadius.circular(20),
color: colorScheme.onSurface, ),
), child: Text(
overflow: TextOverflow.ellipsis, request.statusText.toUpperCase(),
), style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: _getStatusColor(),
), ),
const SizedBox(width: 8), ),
Container( ),
padding: const EdgeInsets.symmetric( const SizedBox(height: 8),
horizontal: 12,
vertical: 6, Text(
), 'Mã yêu cầu: #${request.id}',
decoration: BoxDecoration( style: TextStyle(
color: _getStatusBackgroundColor(), fontSize: 16,
borderRadius: BorderRadius.circular(20), fontWeight: FontWeight.w700,
), color: colorScheme.onSurface,
child: Text( ),
request.statusText.toUpperCase(), overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: _getStatusColor(),
),
),
),
],
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
@@ -566,16 +561,16 @@ class _RequestCard extends StatelessWidget {
), ),
), ),
if (request.plainDescription.isNotEmpty) ...[ // if (request.plainDescription.isNotEmpty) ...[
const SizedBox(height: 4), // const SizedBox(height: 4),
// Description // // Description
Text( // Text(
request.plainDescription, // request.plainDescription,
style: TextStyle(fontSize: 14, color: colorScheme.onSurfaceVariant), // style: TextStyle(fontSize: 14, color: colorScheme.onSurfaceVariant),
maxLines: 2, // maxLines: 2,
overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis,
), // ),
], // ],
], ],
), ),
), ),