feat: update main, exclusive summary and stock
Some checks are pending
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run

This commit is contained in:
Efril 2026-06-24 11:03:28 +07:00
parent 843c11b200
commit 75415cc6ff
11 changed files with 993 additions and 742 deletions

View File

@ -520,5 +520,23 @@
"net_profit_loss": "Net Profit/Loss", "net_profit_loss": "Net Profit/Loss",
"@net_profit_loss": {}, "@net_profit_loss": {},
"cost_breakdown": "Cost Breakdown", "cost_breakdown": "Cost Breakdown",
"@cost_breakdown": {} "@cost_breakdown": {},
"all_outlets": "All Outlets",
"@all_outlets": {},
"salary_dw": "DW Salary",
"@salary_dw": {},
"salary_staff": "Staff Salary",
"@salary_staff": {},
"salary_other": "Other Salary",
"@salary_other": {},
"other_operational_expenses": "Other Operational Expenses",
"@other_operational_expenses": {},
"daily_revenue": "Daily Revenue",
"@daily_revenue": {},
"daily_revenue_desc": "Monday Sunday · in thousands of Rupiah",
"@daily_revenue_desc": {},
"no_data_yet": "No data yet",
"@no_data_yet": {},
"total_inventory_value": "Total Inventory Value",
"@total_inventory_value": {}
} }

View File

@ -520,5 +520,23 @@
"net_profit_loss": "Laba/Rugi Bersih", "net_profit_loss": "Laba/Rugi Bersih",
"@net_profit_loss": {}, "@net_profit_loss": {},
"cost_breakdown": "Rincian Biaya", "cost_breakdown": "Rincian Biaya",
"@cost_breakdown": {} "@cost_breakdown": {},
"all_outlets": "Semua Outlet",
"@all_outlets": {},
"salary_dw": "Gaji DW",
"@salary_dw": {},
"salary_staff": "Gaji Staff",
"@salary_staff": {},
"salary_other": "Gaji Lainnya",
"@salary_other": {},
"other_operational_expenses": "Biaya Ops Lainnya",
"@other_operational_expenses": {},
"daily_revenue": "Omzet Harian",
"@daily_revenue": {},
"daily_revenue_desc": "Senin Minggu · dalam ribuan Rupiah",
"@daily_revenue_desc": {},
"no_data_yet": "Belum ada data",
"@no_data_yet": {},
"total_inventory_value": "Total Nilai Inventori",
"@total_inventory_value": {}
} }

View File

@ -1510,6 +1510,60 @@ abstract class AppLocalizations {
/// In en, this message translates to: /// In en, this message translates to:
/// **'Cost Breakdown'** /// **'Cost Breakdown'**
String get cost_breakdown; String get cost_breakdown;
/// No description provided for @all_outlets.
///
/// In en, this message translates to:
/// **'All Outlets'**
String get all_outlets;
/// No description provided for @salary_dw.
///
/// In en, this message translates to:
/// **'DW Salary'**
String get salary_dw;
/// No description provided for @salary_staff.
///
/// In en, this message translates to:
/// **'Staff Salary'**
String get salary_staff;
/// No description provided for @salary_other.
///
/// In en, this message translates to:
/// **'Other Salary'**
String get salary_other;
/// No description provided for @other_operational_expenses.
///
/// In en, this message translates to:
/// **'Other Operational Expenses'**
String get other_operational_expenses;
/// No description provided for @daily_revenue.
///
/// In en, this message translates to:
/// **'Daily Revenue'**
String get daily_revenue;
/// No description provided for @daily_revenue_desc.
///
/// In en, this message translates to:
/// **'Monday Sunday · in thousands of Rupiah'**
String get daily_revenue_desc;
/// No description provided for @no_data_yet.
///
/// In en, this message translates to:
/// **'No data yet'**
String get no_data_yet;
/// No description provided for @total_inventory_value.
///
/// In en, this message translates to:
/// **'Total Inventory Value'**
String get total_inventory_value;
} }
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> { class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {

View File

@ -729,4 +729,31 @@ class AppLocalizationsEn extends AppLocalizations {
@override @override
String get cost_breakdown => 'Cost Breakdown'; String get cost_breakdown => 'Cost Breakdown';
@override
String get all_outlets => 'All Outlets';
@override
String get salary_dw => 'DW Salary';
@override
String get salary_staff => 'Staff Salary';
@override
String get salary_other => 'Other Salary';
@override
String get other_operational_expenses => 'Other Operational Expenses';
@override
String get daily_revenue => 'Daily Revenue';
@override
String get daily_revenue_desc => 'Monday Sunday · in thousands of Rupiah';
@override
String get no_data_yet => 'No data yet';
@override
String get total_inventory_value => 'Total Inventory Value';
} }

View File

@ -729,4 +729,31 @@ class AppLocalizationsId extends AppLocalizations {
@override @override
String get cost_breakdown => 'Rincian Biaya'; String get cost_breakdown => 'Rincian Biaya';
@override
String get all_outlets => 'Semua Outlet';
@override
String get salary_dw => 'Gaji DW';
@override
String get salary_staff => 'Gaji Staff';
@override
String get salary_other => 'Gaji Lainnya';
@override
String get other_operational_expenses => 'Biaya Ops Lainnya';
@override
String get daily_revenue => 'Omzet Harian';
@override
String get daily_revenue_desc => 'Senin Minggu · dalam ribuan Rupiah';
@override
String get no_data_yet => 'Belum ada data';
@override
String get total_inventory_value => 'Total Nilai Inventori';
} }

View File

@ -0,0 +1,186 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import '../../../../common/extension/extension.dart';
import '../../../../common/theme/theme.dart';
import '../../../../domain/analytic/analytic.dart';
class DailyRevenueChart extends StatelessWidget {
final List<DashboardRecentSale> salesData;
const DailyRevenueChart({super.key, required this.salesData});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColor.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: AppColor.textLight.withOpacity(0.08),
spreadRadius: 1,
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Title
Text(
context.lang.daily_revenue,
style: AppStyle.lg.copyWith(
fontWeight: FontWeight.w700,
color: AppColor.textPrimary,
),
),
const SizedBox(height: 4),
Text(
context.lang.daily_revenue_desc,
style: AppStyle.sm.copyWith(
color: AppColor.textSecondary,
fontWeight: FontWeight.w400,
),
),
const SizedBox(height: 24),
// Bar Chart
salesData.isEmpty
? _buildEmptyState()
: SizedBox(height: 200, child: _buildBarChart()),
],
),
);
}
Widget _buildEmptyState() {
return SizedBox(
height: 200,
child: Center(
child: Builder(
builder: (context) => Text(
context.lang.no_data_yet,
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
),
),
),
);
}
Widget _buildBarChart() {
final maxValue = _getMaxValue();
return BarChart(
BarChartData(
alignment: BarChartAlignment.spaceAround,
maxY: maxValue,
minY: 0,
barTouchData: BarTouchData(
enabled: true,
touchTooltipData: BarTouchTooltipData(
tooltipPadding: const EdgeInsets.all(8),
getTooltipItem: (group, groupIndex, rod, rodIndex) {
if (groupIndex < salesData.length) {
final sale = salesData[groupIndex];
return BarTooltipItem(
sale.sales.currencyFormatRp,
const TextStyle(
color: AppColor.textWhite,
fontWeight: FontWeight.bold,
fontSize: 12,
),
);
}
return null;
},
),
),
titlesData: FlTitlesData(
show: true,
topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
leftTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 30,
getTitlesWidget: (value, meta) {
final index = value.toInt();
if (index >= 0 && index < salesData.length) {
final date = DateTime.tryParse(salesData[index].date);
final dayName = date != null
? _getShortDayName(date.weekday)
: '';
return Padding(
padding: const EdgeInsets.only(top: 8),
child: Text(
dayName,
style: AppStyle.sm.copyWith(
color: AppColor.textSecondary,
fontWeight: FontWeight.w500,
),
),
);
}
return const SizedBox.shrink();
},
),
),
),
gridData: FlGridData(show: false),
borderData: FlBorderData(show: false),
barGroups: _buildBarGroups(maxValue),
),
);
}
List<BarChartGroupData> _buildBarGroups(double maxValue) {
return salesData.asMap().entries.map((entry) {
final index = entry.key;
final sale = entry.value;
final value = sale.sales.toDouble();
// Gradient from green to lighter green for higher values
final ratio = maxValue > 0 ? value / maxValue : 0.0;
final color = Color.lerp(
AppColor.success,
AppColor.success.withGreen(230),
ratio,
)!;
return BarChartGroupData(
x: index,
barRods: [
BarChartRodData(
toY: value,
width: 28,
borderRadius: BorderRadius.circular(8),
gradient: LinearGradient(
colors: [color, color.withOpacity(0.8)],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
),
),
],
);
}).toList();
}
double _getMaxValue() {
if (salesData.isEmpty) return 1000000;
final maxValue = salesData
.map((e) => e.sales.toDouble())
.reduce((a, b) => a > b ? a : b);
return maxValue * 1.2;
}
String _getShortDayName(int weekday) {
const days = ['Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab', 'Min'];
return days[weekday - 1];
}
}

View File

@ -27,7 +27,7 @@ class InventoryHeader extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final outletLabel = state.inventoryAnalytic.summary.outletName.isNotEmpty final outletLabel = state.inventoryAnalytic.summary.outletName.isNotEmpty
? state.inventoryAnalytic.summary.outletName ? state.inventoryAnalytic.summary.outletName
: 'Semua Outlet'; : context.lang.all_outlets;
final dateLabel = _formatDateRange(state.dateFrom, state.dateTo); final dateLabel = _formatDateRange(state.dateFrom, state.dateTo);
return Container( return Container(
@ -103,6 +103,7 @@ class InventoryHeader extends StatelessWidget {
// Back button + Title row + Calendar button // Back button + Title row + Calendar button
Row( Row(
children: [ children: [
if (context.router.canPop()) ...[
GestureDetector( GestureDetector(
onTap: () => context.router.maybePop(), onTap: () => context.router.maybePop(),
child: Container( child: Container(
@ -120,6 +121,7 @@ class InventoryHeader extends StatelessWidget {
), ),
), ),
const SpaceWidth(12), const SpaceWidth(12),
],
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -176,7 +178,7 @@ class InventoryHeader extends StatelessWidget {
// Total Value label // Total Value label
Text( Text(
'Total Nilai Inventori', context.lang.total_inventory_value,
style: AppStyle.sm.copyWith( style: AppStyle.sm.copyWith(
color: AppColor.textWhite.withOpacity(0.75), color: AppColor.textWhite.withOpacity(0.75),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,

View File

@ -11,7 +11,12 @@ class MainPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AutoTabsRouter.pageView( return AutoTabsRouter.pageView(
routes: [HomeRoute(), OrderRoute(), ReportRoute(), ProfileRoute()], routes: [
HomeRoute(),
ExclusiveSummaryRoute(),
InventoryRoute(),
ProfileRoute(),
],
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
builder: (context, child, pageController) { builder: (context, child, pageController) {
final tabsRouter = AutoTabsRouter.of(context); final tabsRouter = AutoTabsRouter.of(context);

View File

@ -30,16 +30,16 @@ class _MainBottomNavbarState extends State<MainBottomNavbar> {
label: context.lang.home, label: context.lang.home,
tooltip: context.lang.home, tooltip: context.lang.home,
), ),
BottomNavigationBarItem(
icon: HugeIcon(icon: HugeIcons.strokeRoundedBorderFull),
label: context.lang.order,
tooltip: context.lang.order,
),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: HugeIcon(icon: HugeIcons.strokeRoundedChart03), icon: HugeIcon(icon: HugeIcons.strokeRoundedChart03),
label: context.lang.report, label: context.lang.report,
tooltip: context.lang.report, tooltip: context.lang.report,
), ),
BottomNavigationBarItem(
icon: HugeIcon(icon: HugeIcons.strokeRoundedPackage),
label: context.lang.stock,
tooltip: context.lang.stock,
),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: HugeIcon(icon: HugeIcons.strokeRoundedUser), icon: HugeIcon(icon: HugeIcons.strokeRoundedUser),
label: context.lang.profile, label: context.lang.profile,

View File

@ -16,8 +16,8 @@ class AppRouter extends RootStackRouter {
page: MainRoute.page, page: MainRoute.page,
children: [ children: [
AutoRoute(page: HomeRoute.page), AutoRoute(page: HomeRoute.page),
AutoRoute(page: OrderRoute.page), AutoRoute(page: InventoryRoute.page),
AutoRoute(page: ReportRoute.page), AutoRoute(page: ExclusiveSummaryRoute.page),
AutoRoute(page: ProfileRoute.page), AutoRoute(page: ProfileRoute.page),
], ],
), ),