feat: Implement hub and role matching for order creation and remove payment, savings, and export sections from the billing page.

This commit is contained in:
Achintha Isuru
2026-02-27 21:32:12 -05:00
parent 95175536a0
commit bba4054143
4 changed files with 159 additions and 131 deletions

View File

@@ -9,7 +9,6 @@ import '../blocs/billing_bloc.dart';
import '../blocs/billing_event.dart';
import '../blocs/billing_state.dart';
import '../widgets/invoice_history_section.dart';
import '../widgets/payment_method_card.dart';
import '../widgets/pending_invoices_section.dart';
import '../widgets/spending_breakdown_card.dart';
@@ -106,14 +105,14 @@ class _BillingViewState extends State<BillingView> {
),
title: Text(
t.client_billing.title,
style: UiTypography.headline3b.copyWith(color: UiColors.white),
style: UiTypography.headline3b.copyWith(
color: UiColors.white,
),
),
centerTitle: false,
flexibleSpace: FlexibleSpaceBar(
background: Padding(
padding: const EdgeInsets.only(
bottom: UiConstants.space8,
),
padding: const EdgeInsets.only(bottom: UiConstants.space8),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
@@ -224,90 +223,16 @@ class _BillingViewState extends State<BillingView> {
if (state.pendingInvoices.isNotEmpty) ...<Widget>[
PendingInvoicesSection(invoices: state.pendingInvoices),
],
const PaymentMethodCard(),
// const PaymentMethodCard(),
const SpendingBreakdownCard(),
_buildSavingsCard(state.savings),
if (state.invoiceHistory.isNotEmpty)
InvoiceHistorySection(invoices: state.invoiceHistory),
_buildExportButton(),
const SizedBox(height: UiConstants.space12),
const SizedBox(height: UiConstants.space16),
],
),
);
}
Widget _buildSavingsCard(double amount) {
return Container(
padding: const EdgeInsets.all(UiConstants.space4),
decoration: BoxDecoration(
color: const Color(0xFFFFFBEB),
borderRadius: UiConstants.radiusLg,
border: Border.all(color: UiColors.accent.withOpacity(0.5)),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.all(UiConstants.space2),
decoration: BoxDecoration(
color: UiColors.accent,
borderRadius: UiConstants.radiusMd,
),
child: const Icon(UiIcons.trendingDown, size: 18, color: UiColors.accentForeground),
),
const SizedBox(width: UiConstants.space3),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
t.client_billing.rate_optimization_title,
style: UiTypography.body2b.textPrimary,
),
const SizedBox(height: 4),
Text.rich(
TextSpan(
style: UiTypography.footnote2r.textSecondary,
children: [
TextSpan(text: t.client_billing.rate_optimization_save),
TextSpan(
text: t.client_billing.rate_optimization_amount(amount: amount.toStringAsFixed(0)),
style: UiTypography.footnote2b.textPrimary,
),
TextSpan(text: t.client_billing.rate_optimization_shifts),
],
),
),
const SizedBox(height: UiConstants.space3),
SizedBox(
height: 32,
child: UiButton.primary(
text: t.client_billing.view_details,
onPressed: () {},
size: UiButtonSize.small,
),
),
],
),
),
],
),
);
}
Widget _buildExportButton() {
return SizedBox(
width: double.infinity,
child: UiButton.secondary(
text: t.client_billing.export_button,
leadingIcon: UiIcons.download,
onPressed: () {},
size: UiButtonSize.large,
),
);
}
Widget _buildEmptyState(BuildContext context) {
return Center(
child: Column(
@@ -361,11 +286,15 @@ class _InvoicesReadyBanner extends StatelessWidget {
children: [
Text(
t.client_billing.invoices_ready_title,
style: UiTypography.body1b.copyWith(color: UiColors.success),
style: UiTypography.body1b.copyWith(
color: UiColors.success,
),
),
Text(
t.client_billing.invoices_ready_subtitle,
style: UiTypography.footnote2r.copyWith(color: UiColors.success),
style: UiTypography.footnote2r.copyWith(
color: UiColors.success,
),
),
],
),

View File

@@ -14,33 +14,11 @@ class InvoiceHistorySection extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
t.client_billing.invoice_history,
style: UiTypography.title2b.textPrimary,
),
TextButton(
onPressed: () {},
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
minimumSize: Size.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: Row(
children: [
Text(
t.client_billing.view_all,
style: UiTypography.body2b.copyWith(color: UiColors.primary),
),
const SizedBox(width: 4),
const Icon(UiIcons.chevronRight, size: 16, color: UiColors.primary),
],
),
),
],
Text(
t.client_billing.invoice_history,
style: UiTypography.title2b.textPrimary,
),
const SizedBox(height: UiConstants.space3),
Container(
@@ -129,12 +107,6 @@ class _InvoiceItem extends StatelessWidget {
_StatusBadge(status: invoice.status),
],
),
const SizedBox(width: UiConstants.space4),
Icon(
UiIcons.download,
size: 20,
color: UiColors.iconSecondary.withOpacity(0.3),
),
],
),
);

View File

@@ -21,18 +21,11 @@ class PendingInvoicesSection extends StatelessWidget {
return GestureDetector(
onTap: () => Modular.to.toAwaitingApproval(),
child: Container(
padding: const EdgeInsets.all(UiConstants.space5),
padding: const EdgeInsets.all(UiConstants.space4),
decoration: BoxDecoration(
color: UiColors.white,
borderRadius: UiConstants.radiusLg,
border: Border.all(color: UiColors.border.withOpacity(0.5)),
boxShadow: [
BoxShadow(
color: UiColors.black.withOpacity(0.04),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: Row(
children: <Widget>[