feat: update main, exclusive summary and stock
Some checks are pending
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run
Some checks are pending
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run
This commit is contained in:
parent
843c11b200
commit
75415cc6ff
@ -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": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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> {
|
||||||
|
|||||||
@ -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';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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';
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -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];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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,23 +103,25 @@ class InventoryHeader extends StatelessWidget {
|
|||||||
// Back button + Title row + Calendar button
|
// Back button + Title row + Calendar button
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
if (context.router.canPop()) ...[
|
||||||
onTap: () => context.router.maybePop(),
|
GestureDetector(
|
||||||
child: Container(
|
onTap: () => context.router.maybePop(),
|
||||||
width: 40,
|
child: Container(
|
||||||
height: 40,
|
width: 40,
|
||||||
decoration: BoxDecoration(
|
height: 40,
|
||||||
color: AppColor.textWhite.withOpacity(0.15),
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12),
|
color: AppColor.textWhite.withOpacity(0.15),
|
||||||
),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: const Icon(
|
),
|
||||||
Icons.chevron_left_rounded,
|
child: const Icon(
|
||||||
color: AppColor.textWhite,
|
Icons.chevron_left_rounded,
|
||||||
size: 24,
|
color: AppColor.textWhite,
|
||||||
|
size: 24,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
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,
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -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),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user