feat: multi-grup sumber, batch send, & perbaikan tip
Multi-Grup Sumber & UI:
- Model ReceiptGroup: satu struk bisa punya banyak grup sumber (
revenue)
- Tombol "Tambah Sumber" dengan dashed border (max 10 grup)
- Hapus label "Dari:" di SourceAccountSelector (chip saja)
- Default 1 grup kosong di ReceiptProvider constructor &
_resetState
Akun Tujuan ke Config:
- Pindah DestinationAccountSelector dari receipt body ke Config
screen
- Persist & load via SharedPreferences (permanen, tidak di-reset)
- Dropdown auto-load dari cache/mirror saat buka Config
- Tombol "Sinkronisasi Manual" sekarang simpan ke mirror &
refresh dropdown
Batch Send via SubmissionTask:
- Model SubmissionTask: konteks per-grup (group/tip +
destination + date)
- TransactionSubmissionDialog refactor: terima
List<SubmissionTask>
- Helper buildTasksFromReceipt &
buildTasksFromAllUnsubmittedReceipts
- LocalReceiptsScreen: tombol "Kirim Semua Nota" + post-process
status
Bug Fix:
- copyWith sentinel pattern: field nullable (tipSourceAccount,
destinationAccount, fireflyUrl, accessToken) kini bisa di-set
ke null
- Tip dapat dibersihkan dengan "Batal Tip" & reset antar
transaksi
- Hapus tombol "Muat Akun" (redundan dgn Sinkronisasi Manual)
Lainnya:
- Date picker untuk tanggal transaksi
- Font courier prime caching via CourierStyles
- Perf: compute() untuk decode image, cancel stream bluetooth,
fix rebuild loop
- External link: <queries> AndroidManifest + skip canLaunchUrl
- Layout cetak: hapus Ke:, sederhanakan separator grup, hapus
TIP: TIDAK
- Hapus TransactionLinksScreen, ganti inline copy/open di popup
2026-06-27 20:18:51 +07:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:cashumit/models/receipt_group.dart';
|
|
|
|
|
import 'package:cashumit/widgets/account_settings_widget.dart';
|
|
|
|
|
import 'package:cashumit/widgets/receipt_item_list.dart';
|
|
|
|
|
import 'package:cashumit/widgets/horizontal_divider.dart';
|
|
|
|
|
import 'package:cashumit/utils/currency_format.dart';
|
|
|
|
|
import 'package:cashumit/utils/app_text_styles.dart';
|
|
|
|
|
|
|
|
|
|
/// Section untuk satu grup transaksi (akun sumber + daftar item + subtotal).
|
|
|
|
|
class ReceiptGroupSection extends StatelessWidget {
|
|
|
|
|
final ReceiptGroup group;
|
|
|
|
|
final int groupIndex;
|
|
|
|
|
final VoidCallback onSelectSource;
|
|
|
|
|
final VoidCallback onRemoveGroup;
|
|
|
|
|
final Function(int)? onEditItem;
|
|
|
|
|
final Function(int)? onRemoveItem;
|
|
|
|
|
final VoidCallback onAddItem;
|
2026-09-04 09:48:34 +07:00
|
|
|
final VoidCallback? onEditTags;
|
feat: multi-grup sumber, batch send, & perbaikan tip
Multi-Grup Sumber & UI:
- Model ReceiptGroup: satu struk bisa punya banyak grup sumber (
revenue)
- Tombol "Tambah Sumber" dengan dashed border (max 10 grup)
- Hapus label "Dari:" di SourceAccountSelector (chip saja)
- Default 1 grup kosong di ReceiptProvider constructor &
_resetState
Akun Tujuan ke Config:
- Pindah DestinationAccountSelector dari receipt body ke Config
screen
- Persist & load via SharedPreferences (permanen, tidak di-reset)
- Dropdown auto-load dari cache/mirror saat buka Config
- Tombol "Sinkronisasi Manual" sekarang simpan ke mirror &
refresh dropdown
Batch Send via SubmissionTask:
- Model SubmissionTask: konteks per-grup (group/tip +
destination + date)
- TransactionSubmissionDialog refactor: terima
List<SubmissionTask>
- Helper buildTasksFromReceipt &
buildTasksFromAllUnsubmittedReceipts
- LocalReceiptsScreen: tombol "Kirim Semua Nota" + post-process
status
Bug Fix:
- copyWith sentinel pattern: field nullable (tipSourceAccount,
destinationAccount, fireflyUrl, accessToken) kini bisa di-set
ke null
- Tip dapat dibersihkan dengan "Batal Tip" & reset antar
transaksi
- Hapus tombol "Muat Akun" (redundan dgn Sinkronisasi Manual)
Lainnya:
- Date picker untuk tanggal transaksi
- Font courier prime caching via CourierStyles
- Perf: compute() untuk decode image, cancel stream bluetooth,
fix rebuild loop
- External link: <queries> AndroidManifest + skip canLaunchUrl
- Layout cetak: hapus Ke:, sederhanakan separator grup, hapus
TIP: TIDAK
- Hapus TransactionLinksScreen, ganti inline copy/open di popup
2026-06-27 20:18:51 +07:00
|
|
|
final bool canRemove;
|
|
|
|
|
|
|
|
|
|
const ReceiptGroupSection({
|
|
|
|
|
super.key,
|
|
|
|
|
required this.group,
|
|
|
|
|
required this.groupIndex,
|
|
|
|
|
required this.onSelectSource,
|
|
|
|
|
required this.onRemoveGroup,
|
|
|
|
|
this.onEditItem,
|
|
|
|
|
this.onRemoveItem,
|
|
|
|
|
required this.onAddItem,
|
2026-09-04 09:48:34 +07:00
|
|
|
this.onEditTags,
|
feat: multi-grup sumber, batch send, & perbaikan tip
Multi-Grup Sumber & UI:
- Model ReceiptGroup: satu struk bisa punya banyak grup sumber (
revenue)
- Tombol "Tambah Sumber" dengan dashed border (max 10 grup)
- Hapus label "Dari:" di SourceAccountSelector (chip saja)
- Default 1 grup kosong di ReceiptProvider constructor &
_resetState
Akun Tujuan ke Config:
- Pindah DestinationAccountSelector dari receipt body ke Config
screen
- Persist & load via SharedPreferences (permanen, tidak di-reset)
- Dropdown auto-load dari cache/mirror saat buka Config
- Tombol "Sinkronisasi Manual" sekarang simpan ke mirror &
refresh dropdown
Batch Send via SubmissionTask:
- Model SubmissionTask: konteks per-grup (group/tip +
destination + date)
- TransactionSubmissionDialog refactor: terima
List<SubmissionTask>
- Helper buildTasksFromReceipt &
buildTasksFromAllUnsubmittedReceipts
- LocalReceiptsScreen: tombol "Kirim Semua Nota" + post-process
status
Bug Fix:
- copyWith sentinel pattern: field nullable (tipSourceAccount,
destinationAccount, fireflyUrl, accessToken) kini bisa di-set
ke null
- Tip dapat dibersihkan dengan "Batal Tip" & reset antar
transaksi
- Hapus tombol "Muat Akun" (redundan dgn Sinkronisasi Manual)
Lainnya:
- Date picker untuk tanggal transaksi
- Font courier prime caching via CourierStyles
- Perf: compute() untuk decode image, cancel stream bluetooth,
fix rebuild loop
- External link: <queries> AndroidManifest + skip canLaunchUrl
- Layout cetak: hapus Ke:, sederhanakan separator grup, hapus
TIP: TIDAK
- Hapus TransactionLinksScreen, ganti inline copy/open di popup
2026-06-27 20:18:51 +07:00
|
|
|
this.canRemove = true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final primaryColor = Theme.of(context).colorScheme.primary;
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
margin: const EdgeInsets.only(bottom: 8),
|
|
|
|
|
padding: const EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(color: Colors.grey[300]!),
|
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
2026-09-04 09:48:34 +07:00
|
|
|
// Header grup: dropdown "Dari:" + simbol tag + tombol hapus di kanan
|
feat: multi-grup sumber, batch send, & perbaikan tip
Multi-Grup Sumber & UI:
- Model ReceiptGroup: satu struk bisa punya banyak grup sumber (
revenue)
- Tombol "Tambah Sumber" dengan dashed border (max 10 grup)
- Hapus label "Dari:" di SourceAccountSelector (chip saja)
- Default 1 grup kosong di ReceiptProvider constructor &
_resetState
Akun Tujuan ke Config:
- Pindah DestinationAccountSelector dari receipt body ke Config
screen
- Persist & load via SharedPreferences (permanen, tidak di-reset)
- Dropdown auto-load dari cache/mirror saat buka Config
- Tombol "Sinkronisasi Manual" sekarang simpan ke mirror &
refresh dropdown
Batch Send via SubmissionTask:
- Model SubmissionTask: konteks per-grup (group/tip +
destination + date)
- TransactionSubmissionDialog refactor: terima
List<SubmissionTask>
- Helper buildTasksFromReceipt &
buildTasksFromAllUnsubmittedReceipts
- LocalReceiptsScreen: tombol "Kirim Semua Nota" + post-process
status
Bug Fix:
- copyWith sentinel pattern: field nullable (tipSourceAccount,
destinationAccount, fireflyUrl, accessToken) kini bisa di-set
ke null
- Tip dapat dibersihkan dengan "Batal Tip" & reset antar
transaksi
- Hapus tombol "Muat Akun" (redundan dgn Sinkronisasi Manual)
Lainnya:
- Date picker untuk tanggal transaksi
- Font courier prime caching via CourierStyles
- Perf: compute() untuk decode image, cancel stream bluetooth,
fix rebuild loop
- External link: <queries> AndroidManifest + skip canLaunchUrl
- Layout cetak: hapus Ke:, sederhanakan separator grup, hapus
TIP: TIDAK
- Hapus TransactionLinksScreen, ganti inline copy/open di popup
2026-06-27 20:18:51 +07:00
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SourceAccountSelector(
|
|
|
|
|
sourceAccount:
|
|
|
|
|
group.sourceAccountName ?? 'Pilih Sumber',
|
|
|
|
|
onSelectSource: onSelectSource,
|
|
|
|
|
),
|
|
|
|
|
),
|
2026-09-04 09:48:34 +07:00
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
// Simbol tag dengan counter badge
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: onEditTags,
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
child: Badge(
|
|
|
|
|
label: Text(
|
|
|
|
|
'${group.tags.length}',
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
isLabelVisible: group.tags.isNotEmpty,
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
child: Icon(
|
|
|
|
|
group.tags.isNotEmpty
|
|
|
|
|
? Icons.local_offer
|
|
|
|
|
: Icons.local_offer_outlined,
|
|
|
|
|
size: 22,
|
|
|
|
|
color: group.tags.isNotEmpty
|
|
|
|
|
? primaryColor
|
|
|
|
|
: Colors.grey[600],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
feat: multi-grup sumber, batch send, & perbaikan tip
Multi-Grup Sumber & UI:
- Model ReceiptGroup: satu struk bisa punya banyak grup sumber (
revenue)
- Tombol "Tambah Sumber" dengan dashed border (max 10 grup)
- Hapus label "Dari:" di SourceAccountSelector (chip saja)
- Default 1 grup kosong di ReceiptProvider constructor &
_resetState
Akun Tujuan ke Config:
- Pindah DestinationAccountSelector dari receipt body ke Config
screen
- Persist & load via SharedPreferences (permanen, tidak di-reset)
- Dropdown auto-load dari cache/mirror saat buka Config
- Tombol "Sinkronisasi Manual" sekarang simpan ke mirror &
refresh dropdown
Batch Send via SubmissionTask:
- Model SubmissionTask: konteks per-grup (group/tip +
destination + date)
- TransactionSubmissionDialog refactor: terima
List<SubmissionTask>
- Helper buildTasksFromReceipt &
buildTasksFromAllUnsubmittedReceipts
- LocalReceiptsScreen: tombol "Kirim Semua Nota" + post-process
status
Bug Fix:
- copyWith sentinel pattern: field nullable (tipSourceAccount,
destinationAccount, fireflyUrl, accessToken) kini bisa di-set
ke null
- Tip dapat dibersihkan dengan "Batal Tip" & reset antar
transaksi
- Hapus tombol "Muat Akun" (redundan dgn Sinkronisasi Manual)
Lainnya:
- Date picker untuk tanggal transaksi
- Font courier prime caching via CourierStyles
- Perf: compute() untuk decode image, cancel stream bluetooth,
fix rebuild loop
- External link: <queries> AndroidManifest + skip canLaunchUrl
- Layout cetak: hapus Ke:, sederhanakan separator grup, hapus
TIP: TIDAK
- Hapus TransactionLinksScreen, ganti inline copy/open di popup
2026-06-27 20:18:51 +07:00
|
|
|
if (canRemove) ...[
|
2026-09-04 09:48:34 +07:00
|
|
|
const SizedBox(width: 6),
|
feat: multi-grup sumber, batch send, & perbaikan tip
Multi-Grup Sumber & UI:
- Model ReceiptGroup: satu struk bisa punya banyak grup sumber (
revenue)
- Tombol "Tambah Sumber" dengan dashed border (max 10 grup)
- Hapus label "Dari:" di SourceAccountSelector (chip saja)
- Default 1 grup kosong di ReceiptProvider constructor &
_resetState
Akun Tujuan ke Config:
- Pindah DestinationAccountSelector dari receipt body ke Config
screen
- Persist & load via SharedPreferences (permanen, tidak di-reset)
- Dropdown auto-load dari cache/mirror saat buka Config
- Tombol "Sinkronisasi Manual" sekarang simpan ke mirror &
refresh dropdown
Batch Send via SubmissionTask:
- Model SubmissionTask: konteks per-grup (group/tip +
destination + date)
- TransactionSubmissionDialog refactor: terima
List<SubmissionTask>
- Helper buildTasksFromReceipt &
buildTasksFromAllUnsubmittedReceipts
- LocalReceiptsScreen: tombol "Kirim Semua Nota" + post-process
status
Bug Fix:
- copyWith sentinel pattern: field nullable (tipSourceAccount,
destinationAccount, fireflyUrl, accessToken) kini bisa di-set
ke null
- Tip dapat dibersihkan dengan "Batal Tip" & reset antar
transaksi
- Hapus tombol "Muat Akun" (redundan dgn Sinkronisasi Manual)
Lainnya:
- Date picker untuk tanggal transaksi
- Font courier prime caching via CourierStyles
- Perf: compute() untuk decode image, cancel stream bluetooth,
fix rebuild loop
- External link: <queries> AndroidManifest + skip canLaunchUrl
- Layout cetak: hapus Ke:, sederhanakan separator grup, hapus
TIP: TIDAK
- Hapus TransactionLinksScreen, ganti inline copy/open di popup
2026-06-27 20:18:51 +07:00
|
|
|
IconButton(
|
|
|
|
|
icon: const Icon(Icons.delete_outline, size: 18),
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
constraints: const BoxConstraints(),
|
|
|
|
|
onPressed: onRemoveGroup,
|
|
|
|
|
tooltip: 'Hapus grup',
|
|
|
|
|
color: Colors.red[400],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
2026-09-04 09:48:34 +07:00
|
|
|
if (group.tags.isNotEmpty) ...[
|
|
|
|
|
const SizedBox(height: 6),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: onEditTags,
|
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 2.0),
|
|
|
|
|
child: Wrap(
|
|
|
|
|
spacing: 8,
|
|
|
|
|
runSpacing: 4,
|
|
|
|
|
children: group.tags.map((tag) {
|
|
|
|
|
return Text(
|
|
|
|
|
'#$tag',
|
|
|
|
|
style: CourierStyles.base.copyWith(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
color: Colors.blueGrey[700],
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
feat: multi-grup sumber, batch send, & perbaikan tip
Multi-Grup Sumber & UI:
- Model ReceiptGroup: satu struk bisa punya banyak grup sumber (
revenue)
- Tombol "Tambah Sumber" dengan dashed border (max 10 grup)
- Hapus label "Dari:" di SourceAccountSelector (chip saja)
- Default 1 grup kosong di ReceiptProvider constructor &
_resetState
Akun Tujuan ke Config:
- Pindah DestinationAccountSelector dari receipt body ke Config
screen
- Persist & load via SharedPreferences (permanen, tidak di-reset)
- Dropdown auto-load dari cache/mirror saat buka Config
- Tombol "Sinkronisasi Manual" sekarang simpan ke mirror &
refresh dropdown
Batch Send via SubmissionTask:
- Model SubmissionTask: konteks per-grup (group/tip +
destination + date)
- TransactionSubmissionDialog refactor: terima
List<SubmissionTask>
- Helper buildTasksFromReceipt &
buildTasksFromAllUnsubmittedReceipts
- LocalReceiptsScreen: tombol "Kirim Semua Nota" + post-process
status
Bug Fix:
- copyWith sentinel pattern: field nullable (tipSourceAccount,
destinationAccount, fireflyUrl, accessToken) kini bisa di-set
ke null
- Tip dapat dibersihkan dengan "Batal Tip" & reset antar
transaksi
- Hapus tombol "Muat Akun" (redundan dgn Sinkronisasi Manual)
Lainnya:
- Date picker untuk tanggal transaksi
- Font courier prime caching via CourierStyles
- Perf: compute() untuk decode image, cancel stream bluetooth,
fix rebuild loop
- External link: <queries> AndroidManifest + skip canLaunchUrl
- Layout cetak: hapus Ke:, sederhanakan separator grup, hapus
TIP: TIDAK
- Hapus TransactionLinksScreen, ganti inline copy/open di popup
2026-06-27 20:18:51 +07:00
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
const HorizontalDivider(),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
// Daftar item grup
|
|
|
|
|
ReceiptItemList(
|
|
|
|
|
items: group.items,
|
|
|
|
|
onEditItem: onEditItem,
|
|
|
|
|
onRemoveItem: onRemoveItem,
|
|
|
|
|
onAddItem: onAddItem,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
// Subtotal grup
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'Subtotal:',
|
|
|
|
|
style: CourierStyles.bold.copyWith(fontSize: 13),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
CurrencyFormat.formatRupiah(group.total),
|
|
|
|
|
style: CourierStyles.bold
|
|
|
|
|
.copyWith(fontSize: 13, color: primaryColor),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|