import 'package:aman_kassa_flutter/core/models/halyk/close_day_data.dart' as halyk; import 'package:aman_kassa_flutter/core/models/halyk/halyk_close_day_dao.dart' as halykDao; import 'package:aman_kassa_flutter/core/models/forte/close_day_data.dart' as forte; import 'package:aman_kassa_flutter/core/models/forte/forte_close_day_dao.dart' as forteDao; import 'package:aman_kassa_flutter/core/models/transaction_item.dart'; import 'package:aman_kassa_flutter/shared/shared_styles.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import '../../redux/state/bank_state.dart'; import '../../redux/store.dart'; class CloseDayShowContainer extends StatelessWidget { final dynamic data; DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm:ss"); CloseDayShowContainer(this.data); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(data.title ?? 'Отчет: Закрытие дня POS'), ), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: const EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Общий итоги', style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 15) ), Table( children: [ TableRow(children: [ TableCell(child: Text('Оплат:', style: productTextStyle,)), TableCell(child: Text('${data.paymentCount}', textAlign: TextAlign.center, style: productTextStyle)), TableCell(child: Text('${data.paymentAmount} T', textAlign: TextAlign.end, style: productTextStyle)), ]), TableRow(children: [ TableCell(child: Text('Отмен:', style: productTextStyle,)), TableCell(child: Text('${data.cancelCount}', textAlign: TextAlign.center, style: productTextStyle)), TableCell(child: Text('${data.cancelAmount} T', textAlign: TextAlign.end, style: productTextStyle)), ]), TableRow(children: [ TableCell(child: Text('Возвратов:', style: productTextStyle,)), TableCell(child: Text('${data.refundCount}', textAlign: TextAlign.center, style: productTextStyle)), TableCell(child: Text('${data.refundAmount} T', textAlign: TextAlign.end, style: productTextStyle)), ]), TableRow(children: [ TableCell(child: Text('Итого:', style: productTextStyle,)), TableCell(child: Text('${data.totalCount}', textAlign: TextAlign.center, style: productTextStyle)), TableCell(child: Text('${data.totalAmount} T', textAlign: TextAlign.end, style: productTextStyle)), ]), ], ) ], ), ), Divider(), Expanded( child: ListView.separated( itemCount: data.items?.length ?? 0, separatorBuilder: (BuildContext context, int index) { return Divider(); }, itemBuilder: (BuildContext context, int index) { final BankState? state = Redux.store?.state.bankState; final isForteSessionActive = state?.sessionType == 'Forte'; var item; if (isForteSessionActive == true) { item = data.items!.elementAt(index) as forteDao.TransactionBean; } else { item = data.items!.elementAt(index) as halykDao.TransactionBean; } return ListTile( title: Text(item.instrumentSpecificData?.maskedPan ?? ''), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ if(item.instrumentSpecificData!.cardholderName!=null) Text(item.instrumentSpecificData!.cardholderName!), Text('Операционный день № ${item.operationDay?.toString()}'), ], ), trailing: Text('${item.amount / 100} T'), ); }, ), ), ], ) ); } }