feat: report purchasing
Build & Deploy iOS to TestFlight / build-and-deploy (push) Waiting to run

This commit is contained in:
efrilm
2026-06-22 14:30:38 +07:00
parent c1cefb122b
commit 0b70194d8e
19 changed files with 592 additions and 71 deletions
@@ -14,6 +14,10 @@ import 'package:flutter/widgets.dart';
class $AssetsIconsGen {
const $AssetsIconsGen();
/// File path: assets/icons/ic-report-exclusive-summary.png
AssetGenImage get icReportExclusiveSummary =>
const AssetGenImage('assets/icons/ic-report-exclusive-summary.png');
/// File path: assets/icons/ic-report-product.png
AssetGenImage get icReportProduct =>
const AssetGenImage('assets/icons/ic-report-product.png');
@@ -32,6 +36,7 @@ class $AssetsIconsGen {
/// List of all assets
List<AssetGenImage> get values => [
icReportExclusiveSummary,
icReportProduct,
icReportProfitLoss,
icReportPurchase,
@@ -235,7 +235,7 @@ class DateRangePickerFieldOutlined extends StatefulWidget {
final String? errorText;
const DateRangePickerFieldOutlined({
Key? key,
super.key,
this.label,
this.placeholder = 'Pilih rentang tanggal',
this.startDate,
@@ -246,7 +246,7 @@ class DateRangePickerFieldOutlined extends StatefulWidget {
this.primaryColor = AppColor.primary,
this.enabled = true,
this.errorText,
}) : super(key: key);
});
@override
State<DateRangePickerFieldOutlined> createState() =>
@@ -7,8 +7,7 @@ class EmptySearchWidget extends StatelessWidget {
final String? searchQuery;
final VoidCallback? onClear;
const EmptySearchWidget({Key? key, this.searchQuery, this.onClear})
: super(key: key);
const EmptySearchWidget({super.key, this.searchQuery, this.onClear});
@override
Widget build(BuildContext context) {
+2 -2
View File
@@ -13,14 +13,14 @@ class ErrorPage extends StatefulWidget {
final IconData? errorIcon;
const ErrorPage({
Key? key,
super.key,
this.title,
this.message,
this.onRetry,
this.onBack,
this.errorCode,
this.errorIcon,
}) : super(key: key);
});
@override
State<ErrorPage> createState() => _ErrorPageState();
@@ -308,6 +308,30 @@ class _PurchasePageState extends State<PurchasePage>
],
),
const SpaceHeight(12),
Row(
children: [
Expanded(
child: PurchaseStatCard(
title: 'Bahan Baku',
value: s.rawMaterialPurchases.currencyFormatRp,
icon: LineIcons.leaf,
iconColor: AppColor.secondary,
cardAnimation: _fadeAnimation,
),
),
const SpaceWidth(12),
Expanded(
child: PurchaseStatCard(
title: 'Pengeluaran',
value: s.expensePurchases.currencyFormatRp,
icon: LineIcons.receipt,
iconColor: AppColor.warning,
cardAnimation: _fadeAnimation,
),
),
],
),
const SpaceHeight(12),
Row(
children: [
Expanded(
@@ -325,7 +349,7 @@ class _PurchasePageState extends State<PurchasePage>
title: 'Rata-rata PO',
value: s.averagePurchaseOrderValue.round().currencyFormatRp,
icon: LineIcons.dollarSign,
iconColor: AppColor.secondary,
iconColor: AppColor.secondaryDark,
cardAnimation: _fadeAnimation,
),
),
@@ -336,7 +360,7 @@ class _PurchasePageState extends State<PurchasePage>
children: [
Expanded(
child: PurchaseStatCard(
title: 'Bahan Baku',
title: 'Item Bahan Baku',
value: '${s.totalIngredients} item',
icon: LineIcons.leaf,
iconColor: AppColor.secondaryDark,
@@ -554,6 +578,14 @@ class _PurchasePageState extends State<PurchasePage>
Expanded(child: _shimmerCard(height: 100)),
],
),
const SpaceHeight(12),
Row(
children: [
Expanded(child: _shimmerCard(height: 100)),
const SpaceWidth(12),
Expanded(child: _shimmerCard(height: 100)),
],
),
],
);
}
@@ -37,6 +37,7 @@ class PurchaseVendorCard extends StatelessWidget {
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Rank badge
Container(
@@ -69,7 +70,7 @@ class PurchaseVendorCard extends StatelessWidget {
color: AppColor.info.withOpacity(0.1),
borderRadius: BorderRadius.circular(10),
),
child: Icon(
child: const Icon(
LineIcons.truck,
color: AppColor.info,
size: 20,
@@ -77,31 +78,51 @@ class PurchaseVendorCard extends StatelessWidget {
),
const SizedBox(width: 12),
// Name & details
// Name, chips, and total cost — all in one column
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
data.vendorName.trim(),
style: AppStyle.md.copyWith(
fontWeight: FontWeight.w700,
color: AppColor.textPrimary,
),
),
const SizedBox(height: 4),
// Vendor name + total cost on same row
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
data.vendorName.trim(),
style: AppStyle.md.copyWith(
fontWeight: FontWeight.w700,
color: AppColor.textPrimary,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 8),
Text(
data.totalCost.currencyFormatRp,
style: AppStyle.md.copyWith(
fontWeight: FontWeight.w800,
color: AppColor.primary,
),
),
],
),
const SizedBox(height: 6),
// Chips — wrap to next line if not enough space
Wrap(
spacing: 6,
runSpacing: 4,
children: [
_Chip(
label: '${data.purchaseOrderCount} PO',
color: AppColor.info,
),
const SizedBox(width: 6),
_Chip(
label: '${data.ingredientCount} bahan',
color: AppColor.secondary,
),
const SizedBox(width: 6),
_Chip(
label: '${data.quantity} pcs',
color: AppColor.warning,
@@ -111,15 +132,6 @@ class PurchaseVendorCard extends StatelessWidget {
],
),
),
// Total cost
Text(
data.totalCost.currencyFormatRp,
style: AppStyle.md.copyWith(
fontWeight: FontWeight.w800,
color: AppColor.primary,
),
),
],
),
),