journal_view.dart
parent
17f730eebd
commit
b269c780e7
|
|
@ -9,5 +9,6 @@ class TransactionDao {
|
|||
String? number;
|
||||
String? date;
|
||||
String? day;
|
||||
bool received = true;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:logger/logger.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
|
@ -53,14 +54,23 @@ Future<void> loadJournalData(Store<AppState> store) async {
|
|||
orderBy: '$transactionColumnCreatedAt desc');
|
||||
log.i(set.length);
|
||||
final List<TransactionDao> list = [];
|
||||
|
||||
final DateFormat formatterDay = DateFormat('dd.MM.yyyy');
|
||||
final DateFormat formatterTime = DateFormat('Hms');
|
||||
|
||||
for (final Map<String, dynamic> map in set) {
|
||||
final Transaction transaction = Transaction.fromMap(map);
|
||||
final TransactionData data = TransactionData.fromMap(
|
||||
jsonDecode(transaction.data!));
|
||||
TransactionDao dao = TransactionDao();
|
||||
dao.day = transaction.id.toString();
|
||||
final TransactionDao dao = TransactionDao();
|
||||
dao.id = transaction.id;
|
||||
final DateTime updateAt = DateTime.parse(transaction.updatedAt!);
|
||||
dao.day = formatterDay.format(updateAt);
|
||||
dao.date = formatterTime.format(updateAt);
|
||||
dao.contragentName = data.contragentName;
|
||||
dao.number = data.sellResponse?.journalId.toString() ?? '';
|
||||
dao.total = data.total;
|
||||
|
||||
list.add(dao);
|
||||
}
|
||||
store.dispatch(SetJournalStateAction(JournalState(
|
||||
|
|
|
|||
|
|
@ -73,9 +73,6 @@ class _JournalViewState extends State<JournalView> {
|
|||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Expanded(
|
||||
child: GroupedListView<TransactionDao, String>(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
|
|
@ -91,10 +88,10 @@ class _JournalViewState extends State<JournalView> {
|
|||
),
|
||||
itemBuilder: (context, TransactionDao element) =>
|
||||
TransactionItem(
|
||||
fullName: 'Чек № ${element.number} 13:03:05',
|
||||
fullName: 'Чек № ${element.number} ${element.date}',
|
||||
status: element.contragentName,
|
||||
amount: element.total.toString(),
|
||||
received: true,
|
||||
received: element.received,
|
||||
),
|
||||
itemComparator: (item1, item2) =>
|
||||
item1.day!.compareTo(item2.day!),
|
||||
|
|
@ -102,6 +99,7 @@ class _JournalViewState extends State<JournalView> {
|
|||
useStickyGroupSeparators: true,
|
||||
// optional
|
||||
floatingHeader: true,
|
||||
|
||||
// optional
|
||||
order: GroupedListOrder.DESC, // optional
|
||||
),
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class _PaymentViewState extends State<PaymentView> {
|
|||
nal = _cashSum;
|
||||
}
|
||||
|
||||
bool result =
|
||||
final bool result =
|
||||
await _dataService.sellBtnHandler(card: card, nal: nal, total: _sum);
|
||||
if(result) {
|
||||
_navigatorService.pop();
|
||||
|
|
|
|||
Loading…
Reference in New Issue